top | item 44804497

(no title)

athorax | 6 months ago

Why? JSON is name-value pairs https://www.json.org/json-en.html

discuss

order

caseyohara|6 months ago

Sure, but JSON.parse returns a Hash, which is key-value pairs. The method argument is about the return value, not the input value, so it is more like "Parse this JSON, and symbolize the keys in the resulting Hash before returning it to me". Plus, as mentioned, symbolize_keys is more conventional.

ezekg|6 months ago

I guess I'm more thinking about Ruby/Rails conventions, e.g. methods like Hash#symbolize_keys.

Mixing the two has always been a smell to me, but maybe you're right.