From: "hsbt (Hiroshi SHIBATA) via ruby-core" Date: 2023-04-18T23:02:28+00:00 Subject: [ruby-core:113292] [Ruby master Feature#15541] Add alias symbolize_keys for symbolize_names kwarg for JSON.parse Issue #15541 has been updated by hsbt (Hiroshi SHIBATA). Status changed from Open to Third Party's Issue Assignee set to hsbt (Hiroshi SHIBATA) ---------------------------------------- Feature #15541: Add alias symbolize_keys for symbolize_names kwarg for JSON.parse https://bugs.ruby-lang.org/issues/15541#change-102850 * Author: baweaver (Brandon Weaver) * Status: Third Party's Issue * Priority: Normal * Assignee: hsbt (Hiroshi SHIBATA) ---------------------------------------- https://github.com/ruby/psych/issues/341 When trying to symbolize keys on JSON parsing, it's really hard to remember the name `symbolize_names`: ``` JSON.parse(data, symbolize_names: true) ``` I would like to propose that we change this keyword to `symbolize_keys` to be more clear: ``` JSON.parse(data, symbolize_keys: true) ``` The documentation for this method also reflects the confusion: http://ruby-doc.org/stdlib-2.6/libdoc/json/rdoc/JSON.html#method-i-parse-21 ``` symbolize_names: If set to true, returns symbols for the names (keys) in a JSON object. Otherwise strings are returned. Strings are the default. ``` The same issue came up in Psych not too long ago: https://github.com/ruby/psych/issues/341 I believe the current name causes confusion. Would it be possible to add an alias to this keyword for clarity? -- https://bugs.ruby-lang.org/ ______________________________________________ ruby-core mailing list -- ruby-core@ml.ruby-lang.org To unsubscribe send an email to ruby-core-leave@ml.ruby-lang.org ruby-core info -- https://ml.ruby-lang.org/mailman3/postorius/lists/ruby-core.ml.ruby-lang.org/