Phrogz / NeatJSON

Pretty-print your JSON in Ruby, JS, or Lua with more power than JSON.stringify or JSON.pretty_generate
http://phrogz.net/JS/NeatJSON
MIT License
108 stars 19 forks source link

Default sorting fails with on objects with mixed string/symbol keys #27

Closed reidab closed 6 years ago

reidab commented 6 years ago

Given an object like

{
  :a => 1,
  'b' => 2
}

Generating JSON with sort: true fails with ArgumentError: comparison of Symbol with String failed. This can be worked around by setting sort: ->(k) { k.to_s }, but it seems like it should be handled by default.

Phrogz commented 6 years ago

Thanks for the report! Fixed.