Displaying 3 results from an estimated 3 matches for "unquote_hash_key_identifi".
2007 Sep 28
2
Rails shouldn't output invalid JSON by default
...changeset/7519 and http://dev.rubyonrails.org/changeset/7518).
If there''s a historical reason for it, can someone shed some light?
Worst case is that Rails 2.0 goes out with a big fat JSON warning
about the invalid JSON by default ;)
Oh and the easiest solution: set
ActiveSupport::JSON.unquote_hash_key_identifiers = false
by default in ActiveSupport::JSON (http://dev.rubyonrails.org/browser/
trunk/activesupport/lib/active_support/json/encoding.rb).
Cheers,
Chu Yeow
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups "Ruby...
2008 Jan 30
0
Publish templatized action with JSON gotcha in Rails 1.2
Hey guys-
to_json in Rails 1.2 produces json with unquoted keys, which is
invalid. Therefore, publish_templatized_action produces invalid json
for feed publishing, and you''ll get an error from Facebook. To fix
this, put this line in environment.rb:
ActiveSupport::JSON.unquote_hash_key_identifiers = false
You don''t need to do this if you''re running Rails 2.0. Just a heads
up.. because this stumped me for a while.
Shane
--
http://myfitbuddy.com | http://shanesbrain.net | http://crimsonjet.com
2007 Aug 07
2
"badly formed JSON" exception
I tried to implement the "Rendering JSON in actions" example from
http://wiki.rubyonrails.com/rails/pages/HowtoGenerateJSON :
@headers["Content-Type"] = "text/plain; charset=utf-8"
data = { :foo => ''bar'', :etc => ''rez'' }
render :text => data.to_json
When I try to decode this in javascript with