<?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"
	>
<channel>
	<title>Comments on: Json Decoding Bug in Rails</title>
	<atom:link href="http://blog.inquirylabs.com/2007/05/21/json-decoding-bug-in-rails/feed/" rel="self" type="application/rss+xml" />
	<link>http://blog.inquirylabs.com/2007/05/21/json-decoding-bug-in-rails/</link>
	<description>Politics, Programming and Possibilities</description>
	<pubDate>Mon, 01 Dec 2008 22:44:42 +0000</pubDate>
	<generator>http://wordpress.org/?v=2.6.1</generator>
		<item>
		<title>By: carmen</title>
		<link>http://blog.inquirylabs.com/2007/05/21/json-decoding-bug-in-rails/#comment-15604</link>
		<dc:creator>carmen</dc:creator>
		<pubDate>Wed, 05 Sep 2007 06:18:15 +0000</pubDate>
		<guid isPermaLink="false">http://blog.inquirylabs.com/2007/05/21/json-decoding-bug-in-rails/#comment-15604</guid>
		<description>the ruby+C JSON parser has serious issues, like not being able to parse anything thats not inside a [] and discarding it. im about to dig into the ragel since im sick of the slowness of the pure-ruby gem</description>
		<content:encoded><![CDATA[<p>the ruby+C JSON parser has serious issues, like not being able to parse anything thats not inside a [] and discarding it. im about to dig into the ragel since im sick of the slowness of the pure-ruby gem</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Duane Johnson</title>
		<link>http://blog.inquirylabs.com/2007/05/21/json-decoding-bug-in-rails/#comment-9222</link>
		<dc:creator>Duane Johnson</dc:creator>
		<pubDate>Tue, 22 May 2007 01:26:43 +0000</pubDate>
		<guid isPermaLink="false">http://blog.inquirylabs.com/2007/05/21/json-decoding-bug-in-rails/#comment-9222</guid>
		<description>True, it's not part of the JSON spec, but single-quoted strings *would* technically parse just fine when eval'ed in javascript---so maybe that's why the Rails parser (among others) is a little lenient there.</description>
		<content:encoded><![CDATA[<p>True, it&#8217;s not part of the JSON spec, but single-quoted strings *would* technically parse just fine when eval&#8217;ed in javascript&#8212;so maybe that&#8217;s why the Rails parser (among others) is a little lenient there.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Piers Cawley</title>
		<link>http://blog.inquirylabs.com/2007/05/21/json-decoding-bug-in-rails/#comment-9217</link>
		<dc:creator>Piers Cawley</dc:creator>
		<pubDate>Mon, 21 May 2007 22:46:20 +0000</pubDate>
		<guid isPermaLink="false">http://blog.inquirylabs.com/2007/05/21/json-decoding-bug-in-rails/#comment-9217</guid>
		<description>Meanwhile, I've just been bitten by Ragel based JSON gem deciding that &lt;code&gt;{"title": "That\\'s great"}&lt;/code&gt; is illegal despite the spec saying that any character may be escaped. Which would be fine if I had control over the feed, but I was trying to parse a del.icio.us.feed...

The regular expression for matching a JSON string looks like this:

  /"((?:[^\x00-\x1f\\"]&#124;\\(?:u[\da-fA-F]{4}&#124;.))*)"/

It's not the most efficient variant that will do the match, but it'll serve. Unescaping the matched string is a little bit trickier, but, it's not really rocket science.

I do wonder why the Rails even *cares* about single quotes in this context though; they don't appear to be legal string delimiters in the JSON spec.</description>
		<content:encoded><![CDATA[<p>Meanwhile, I&#8217;ve just been bitten by Ragel based JSON gem deciding that <code>{"title": "That\\'s great"}</code> is illegal despite the spec saying that any character may be escaped. Which would be fine if I had control over the feed, but I was trying to parse a del.icio.us.feed&#8230;</p>
<p>The regular expression for matching a JSON string looks like this:</p>
<p>  /&#8221;((?:[^\x00-\x1f\\"]|\\(?:u[\da-fA-F]{4}|.))*)&#8221;/</p>
<p>It&#8217;s not the most efficient variant that will do the match, but it&#8217;ll serve. Unescaping the matched string is a little bit trickier, but, it&#8217;s not really rocket science.</p>
<p>I do wonder why the Rails even *cares* about single quotes in this context though; they don&#8217;t appear to be legal string delimiters in the JSON spec.</p>
]]></content:encoded>
	</item>
</channel>
</rss>
