Skip to content

Instantly share code, notes, and snippets.

@stefl
Created February 5, 2011 19:25
Show Gist options
  • Save stefl/812700 to your computer and use it in GitHub Desktop.
Save stefl/812700 to your computer and use it in GitHub Desktop.
Json gem users take note...
# Deal with the usual JSON gem idiocy. Guys, come on. I want to serialize an integer, surely this can't be that hard
class Fixnum
def to_json(options = nil)
to_s
end
end
@DRMacIver
Copy link

Integers are JSON values, not JSON text. JSON generators are required to output JSON text, which is just objects and arrays. (Yes, it's stupid).

What's the actual code you have that's failing?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment