<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	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/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>Blog &#187; json</title>
	<atom:link href="http://blog.cliffano.com/tag/json/feed/" rel="self" type="application/rss+xml" />
	<link>http://blog.cliffano.com</link>
	<description>Geeking, Living, Travelling</description>
	<lastBuildDate>Thu, 26 Jan 2012 10:18:59 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.3.1</generator>
		<item>
		<title>Trailing Comma Within JSON&#039;s Array</title>
		<link>http://blog.cliffano.com/2006/04/18/trailing-comma-within-jsons-array/</link>
		<comments>http://blog.cliffano.com/2006/04/18/trailing-comma-within-jsons-array/#comments</comments>
		<pubDate>Tue, 18 Apr 2006 13:00:06 +0000</pubDate>
		<dc:creator>Cliffano Subagio</dc:creator>
				<category><![CDATA[Projects]]></category>
		<category><![CDATA[javascript]]></category>
		<category><![CDATA[json]]></category>

		<guid isPermaLink="false">http://blog.cliffano.com/?p=31</guid>
		<description><![CDATA[I was debugging an AJAXy app which uses JSON as the data format, and it was fine with Firefox but not with Internet Explorer. After further debugging, the culprit turned out to be trailing commas within the data. theObject.foo.bar.length returns 2 in Firefox, but it returns 3 in Internet Explorer. The solution was obviously to [...]]]></description>
			<content:encoded><![CDATA[<p>I was debugging an AJAXy app which uses <a href="http://www.json.org/">JSON</a> as the data format, and it was fine with Firefox but not with Internet Explorer. After further debugging, the culprit turned out to be trailing commas within the data.</p>
<pre class="brush: jscript; title: ; notranslate">
{&quot;foo&quot;: {
    &quot;bar&quot;: [
        {&quot;id&quot;: &quot;1&quot;, &quot;url&quot;: &quot;http://www.hostA.com&quot;},
        {&quot;id&quot;: &quot;2&quot;, &quot;url&quot;: &quot;http://www.hostB.com&quot;},
] }}
</pre>
<p>theObject.foo.bar.length returns 2 in Firefox, but it returns 3 in Internet Explorer. The solution was obviously to remove the last comma.</p>
<p>I&#8217;m guessing the problem is more to Javascript array.length which is handled differently between browsers.</p>
<p><strong>Update</strong>: HTML comments embedded within what&#8217;s supposed to be JSON&#8217;s data will be ignored by Firefox, while they will cause failure during eval in Internet Explorer.</p>

<p class="FacebookLikeButton"><fb:like href="http%3A%2F%2Fblog.cliffano.com%2F2006%2F04%2F18%2Ftrailing-comma-within-jsons-array%2F" layout="standard" show_faces="false" width="450" action="like" colorscheme="light"></fb:like></p>
]]></content:encoded>
			<wfw:commentRss>http://blog.cliffano.com/2006/04/18/trailing-comma-within-jsons-array/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
	</channel>
</rss>

