[HN Gopher] What's wrong with the JSON gem API?
       ___________________________________________________________________
        
       What's wrong with the JSON gem API?
        
       Author : ezekg
       Score  : 22 points
       Date   : 2025-08-05 20:46 UTC (2 hours ago)
        
 (HTM) web link (byroot.github.io)
 (TXT) w3m dump (byroot.github.io)
        
       | ezekg wrote:
       | First thing we could do here is rename the JSON.parse
       | :symbolize_names keyword to :symbolize_keys -- always trips me up
       | for some reason.
        
         | athorax wrote:
         | Why? JSON is name-value pairs https://www.json.org/json-en.html
        
           | ezekg wrote:
           | 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.
        
           | caseyohara wrote:
           | 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.
        
         | fuzzy_biscuit wrote:
         | Maybe it could just be an alias. People do also refer to them
         | as key-value pairs, so that feels reasonable.
        
       | jmull wrote:
       | Changing the default behavior for duplicate keys is
       | unnecessary... and therefore should not be done.
       | 
       | IMO, it's nuts to purposely introduce random bugs into the apps
       | of everyone who uses your dependency.
        
       ___________________________________________________________________
       (page generated 2025-08-05 23:00 UTC)