From: keystonelemur@... Date: 2019-01-23T17:10:24+00:00 Subject: [ruby-core:91233] [Ruby trunk Feature#15541] Add alias symbolize_keys for symbolize_names kwarg for JSON.parse Issue #15541 has been updated by baweaver (Brandon Weaver). shevegen (Robert A. Heiler) wrote: > Personally I think that alias name would make sense. With a new alias the backwards > behaviour would also be retained. An alias would probably be best as otherwise it would cause breaking changes, and I think we'd rather avoid that. ---------------------------------------- Feature #15541: Add alias symbolize_keys for symbolize_names kwarg for JSON.parse https://bugs.ruby-lang.org/issues/15541#change-76479 * Author: baweaver (Brandon Weaver) * Status: Open * Priority: Normal * Assignee: * Target version: ---------------------------------------- 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/ Unsubscribe: