json icon indicating copy to clipboard operation
json copied to clipboard

when generate json from ruby object, "ascii_only" not work, why???

Open jhjguxin opened this issue 12 years ago • 2 comments

when I encode some hash to json on rails 4, I found the method encode json is change.

so I generate json, by call JSON.generate(object, :ascii_only => true), but when object is an class instance it not work.

more info please check testjson

jhjguxin avatar Aug 16 '13 05:08 jhjguxin

Apparently rails4 breaks this by first overwriting the methods JSON gem set up to generate JSON and then not passing along any of the original options into their encoder classes and consequently to JSON gem's generation code after they call it from the new methods. I mean who needs these options anyway, am I rite?

flori avatar Aug 16 '13 08:08 flori

Yes, I want these options still work so that can have same result from exec JSON.generate(hash_object, :ascii_only => true). additional, could you show me how rails4(activesupport) breaks this by first overwriting the methods JSON gem set up to generate JSON and then not passing along any of the original options into their encoder classes and consequently to JSON gem's generation code after they call it from the new methods. ??

jhjguxin avatar Aug 16 '13 09:08 jhjguxin