Created
February 5, 2011 19:25
-
-
Save stefl/812700 to your computer and use it in GitHub Desktop.
Json gem users take note...
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# 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 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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?