<?xml version="1.0" encoding="UTF-8"?><rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
		>
<channel>
	<title>Comments on: How to get strictly valid JSON from Rails</title>
	<atom:link href="http://blog.codefront.net/2007/06/20/how-to-get-strictly-valid-json-from-rails/feed/" rel="self" type="application/rss+xml" />
	<link>http://blog.codefront.net/2007/06/20/how-to-get-strictly-valid-json-from-rails/</link>
	<description>Rails, Firefox, Anime, Mac</description>
	<lastBuildDate>Thu, 18 Mar 2010 03:29:48 +0000</lastBuildDate>
	<generator>http://wordpress.org/?v=2.9.2</generator>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
		<item>
		<title>By: Cameron Barrie</title>
		<link>http://blog.codefront.net/2007/06/20/how-to-get-strictly-valid-json-from-rails/comment-page-1/#comment-302155</link>
		<dc:creator>Cameron Barrie</dc:creator>
		<pubDate>Fri, 12 Oct 2007 02:16:48 +0000</pubDate>
		<guid isPermaLink="false">http://blog.codefront.net/2007/06/20/how-to-get-strictly-valid-json-from-rails/#comment-302155</guid>
		<description>If you need to pass json without the attributes. 

@object.attributes.to_json</description>
		<content:encoded><![CDATA[<p>If you need to pass json without the attributes. </p>
<p>@object.attributes.to_json</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Valid JSON from Rails Life is grand</title>
		<link>http://blog.codefront.net/2007/06/20/how-to-get-strictly-valid-json-from-rails/comment-page-1/#comment-290535</link>
		<dc:creator>Valid JSON from Rails Life is grand</dc:creator>
		<pubDate>Fri, 28 Sep 2007 15:49:07 +0000</pubDate>
		<guid isPermaLink="false">http://blog.codefront.net/2007/06/20/how-to-get-strictly-valid-json-from-rails/#comment-290535</guid>
		<description>[...] it is pretty easy to tell Rails to emit valid JSON. Just set ActiveSupport::JSON.unquote_hash_key_identifiers = false in your [...]</description>
		<content:encoded><![CDATA[<p>[...] it is pretty easy to tell Rails to emit valid JSON. Just set ActiveSupport::JSON.unquote_hash_key_identifiers = false in your [...]</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Better JSON output from Rails with the Jsonifier plugin - redemption in a blog</title>
		<link>http://blog.codefront.net/2007/06/20/how-to-get-strictly-valid-json-from-rails/comment-page-1/#comment-223473</link>
		<dc:creator>Better JSON output from Rails with the Jsonifier plugin - redemption in a blog</dc:creator>
		<pubDate>Wed, 11 Jul 2007 04:46:48 +0000</pubDate>
		<guid isPermaLink="false">http://blog.codefront.net/2007/06/20/how-to-get-strictly-valid-json-from-rails/#comment-223473</guid>
		<description>[...] your environment.rb (or in the Rails initializers directory if you&#8217;re on edge). See my blog post on how to get strictly valid JSON from Rails for more info.   Posted by Chu Yeow at July 11, 2007 SGT &#124;  Permalink &#124;  &#124; Category: Ruby on Rails, [...]</description>
		<content:encoded><![CDATA[<p>[...] your environment.rb (or in the Rails initializers directory if you&#8217;re on edge). See my blog post on how to get strictly valid JSON from Rails for more info.   Posted by Chu Yeow at July 11, 2007 SGT |  Permalink |  | Category: Ruby on Rails, [...]</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Gary</title>
		<link>http://blog.codefront.net/2007/06/20/how-to-get-strictly-valid-json-from-rails/comment-page-1/#comment-216006</link>
		<dc:creator>Gary</dc:creator>
		<pubDate>Tue, 03 Jul 2007 13:27:48 +0000</pubDate>
		<guid isPermaLink="false">http://blog.codefront.net/2007/06/20/how-to-get-strictly-valid-json-from-rails/#comment-216006</guid>
		<description>Near as I can tell, in JS the only place this type of JSON would work in the default configuration is in a pure Eval - which is usually a no-no. All the code I saw for more security conscious JSON parsing (e.g. Crockford) barfed on the unquoted keys, have to agree this is kinda weird behaviour by default.</description>
		<content:encoded><![CDATA[<p>Near as I can tell, in JS the only place this type of JSON would work in the default configuration is in a pure Eval &#8211; which is usually a no-no. All the code I saw for more security conscious JSON parsing (e.g. Crockford) barfed on the unquoted keys, have to agree this is kinda weird behaviour by default.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: divotdave</title>
		<link>http://blog.codefront.net/2007/06/20/how-to-get-strictly-valid-json-from-rails/comment-page-1/#comment-202568</link>
		<dc:creator>divotdave</dc:creator>
		<pubDate>Fri, 22 Jun 2007 21:18:31 +0000</pubDate>
		<guid isPermaLink="false">http://blog.codefront.net/2007/06/20/how-to-get-strictly-valid-json-from-rails/#comment-202568</guid>
		<description>For the benefit of anyone else...

Each &#039;attributes&#039; key constitutes a separate hash object with its own index (i.e. 0, 1, etc.). So to access the value of &#039;title&#039; as in my previous post you would do this (in js of course):

&lt;code&gt;var myObj = myJsonCallback(json_response);
alert(myObj[0].attributes.title);&lt;/code&gt;

Which will return the value &quot;My first story&quot; or whatever.

Cheers,
divotdave</description>
		<content:encoded><![CDATA[<p>For the benefit of anyone else&#8230;</p>
<p>Each &#8216;attributes&#8217; key constitutes a separate hash object with its own index (i.e. 0, 1, etc.). So to access the value of &#8216;title&#8217; as in my previous post you would do this (in js of course):</p>
<p><code>var myObj = myJsonCallback(json_response);<br />
alert(myObj[0].attributes.title);</code></p>
<p>Which will return the value &#8220;My first story&#8221; or whatever.</p>
<p>Cheers,<br />
divotdave</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: divotdave</title>
		<link>http://blog.codefront.net/2007/06/20/how-to-get-strictly-valid-json-from-rails/comment-page-1/#comment-202449</link>
		<dc:creator>divotdave</dc:creator>
		<pubDate>Fri, 22 Jun 2007 19:48:46 +0000</pubDate>
		<guid isPermaLink="false">http://blog.codefront.net/2007/06/20/how-to-get-strictly-valid-json-from-rails/#comment-202449</guid>
		<description>Nice work - I had earlier discovered this myself.

My main problem now is that when I use to_json on a collection object (i.e. @foo.to_json) the output includes a &#039;attributes&#039; key for each record of data which makes it difficult for me to work with in Javascript when using a callback.

Like this:

list([{&quot;attributes&quot;: {&quot;title&quot;: &quot;Here is my new story&quot;}}, {&quot;attributes&quot;: {&quot;title&quot;: &quot;I love this stuff!&quot;}}, {&quot;attributes&quot;: {&quot;title&quot;: &quot;Here is another story&quot;}}])

I can&#039;t figure out how to

A) remove the attributes key from the collection hash -or-
B) how to access the data I want around the repeated attributes values (i.e. title).

Any clue?

Thanks,
divotdave</description>
		<content:encoded><![CDATA[<p>Nice work &#8211; I had earlier discovered this myself.</p>
<p>My main problem now is that when I use to_json on a collection object (i.e. @foo.to_json) the output includes a &#8216;attributes&#8217; key for each record of data which makes it difficult for me to work with in Javascript when using a callback.</p>
<p>Like this:</p>
<p>list([{"attributes": {"title": "Here is my new story"}}, {"attributes": {"title": "I love this stuff!"}}, {"attributes": {"title": "Here is another story"}}])</p>
<p>I can&#8217;t figure out how to</p>
<p>A) remove the attributes key from the collection hash -or-<br />
B) how to access the data I want around the repeated attributes values (i.e. title).</p>
<p>Any clue?</p>
<p>Thanks,<br />
divotdave</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Nathan Fiedler</title>
		<link>http://blog.codefront.net/2007/06/20/how-to-get-strictly-valid-json-from-rails/comment-page-1/#comment-200360</link>
		<dc:creator>Nathan Fiedler</dc:creator>
		<pubDate>Wed, 20 Jun 2007 17:46:23 +0000</pubDate>
		<guid isPermaLink="false">http://blog.codefront.net/2007/06/20/how-to-get-strictly-valid-json-from-rails/#comment-200360</guid>
		<description>Nice tip, thanks. Glad it&#039;s easy to work around, but curious why they chose not to quote the keys...</description>
		<content:encoded><![CDATA[<p>Nice tip, thanks. Glad it&#8217;s easy to work around, but curious why they chose not to quote the keys&#8230;</p>
]]></content:encoded>
	</item>
</channel>
</rss>
