ohler55/oj_mimic_json

ascii_only=>true option is ignored

kapcod opened this issue · 4 comments

JSON mudule supports ascii_only option in similar way Oj does, but not directly in JSON.dump.
oj_mimic_json doesn't pass this option to Oj.

2.0.0-p598 :003 > require 'json'
2.0.0-p598 :004 > JSON.dump("a😬sdf") # => "\"a😬sdf\"" 
2.0.0-p598 :005 > JSON.generate(["a😬sdf"], ascii_only: true) # => "[\"a\\ud83d\\ude2csdf\"]" 
2.0.0-p598 :006 > JSON.dump_default_options[:ascii_only]=true
2.0.0-p598 :007 > JSON.dump(["a😬sdf"]) # => "[\"a\\ud83d\\ude2csdf\"]" 
2.0.0-p598 :008 > require 'oj_mimic_json'
2.0.0-p598 :009 > JSON.generate(["a😬sdf"], ascii_only: true) # => "[\"a😬sdf\"]" 
2.0.0-p598 :010 > JSON.dump(["a😬sdf"]) # => "[\"a😬sdf\"]" 

I'll take a look this weekend and get it fixed up.

I just released a new Oj version. The feature goes in Oj, not in this repo.

I was going to make sure Oj supported the documented feature of the son gem but unfortunately this feature and I'm sure other are not documented. If you find any other features missing please create an issue in the Oj repo.

Thank for bringing this to my attention.

Ok to close?

Sure

On Sep 9, 2016 20:18, "Peter Ohler" notifications@github.com wrote:

Ok to close?

—
You are receiving this because you authored the thread.
Reply to this email directly, view it on GitHub
#3 (comment),
or mute the thread
https://github.com/notifications/unsubscribe-auth/AA6iBh1Q9WxJN9x7J9OwUyOSgOqyoEiXks5qoZTrgaJpZM4Jyg2o
.