Alphabetize JSON object in ruby

Blog
...
# ActiveSupport = a rails thing... json objects are Hashes
json_object = ActiveSupport::JSON.decode(request.body)

# look!  comments in code!  
json_object = Hash[json_object.keys.sort.map {|k| [k, json_object[k]]}]
...

Add new comment