<?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: JSONLib: JSON Extensions a la E4X</title>
	<atom:link href="http://ajaxian.com/archives/jsonlib-json-extensions-a-la-e4x/feed" rel="self" type="application/rss+xml" />
	<link>http://ajaxian.com/archives/jsonlib-json-extensions-a-la-e4x</link>
	<description>Cleaning up the web with Ajax</description>
	<lastBuildDate>Thu, 17 May 2012 07:43:39 +0000</lastBuildDate>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.3.2</generator>
	<item>
		<title>By: Andy</title>
		<link>http://ajaxian.com/archives/jsonlib-json-extensions-a-la-e4x/comment-page-1#comment-260655</link>
		<dc:creator>Andy</dc:creator>
		<pubDate>Fri, 18 Jan 2008 22:42:32 +0000</pubDate>
		<guid isPermaLink="false">http://ajaxian.com/?p=3222#comment-260655</guid>
		<description>All the drawbacks of XML serialization with none of the fake benefits of XML over JSON.</description>
		<content:encoded><![CDATA[<p>All the drawbacks of XML serialization with none of the fake benefits of XML over JSON.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Charles</title>
		<link>http://ajaxian.com/archives/jsonlib-json-extensions-a-la-e4x/comment-page-1#comment-260653</link>
		<dc:creator>Charles</dc:creator>
		<pubDate>Fri, 18 Jan 2008 21:32:08 +0000</pubDate>
		<guid isPermaLink="false">http://ajaxian.com/?p=3222#comment-260653</guid>
		<description>Hello Hedgar,

.I agree that putting objects inside of arrays inside of JSON can be troublesome.  However, in the other direction, a valid JSON Array (or &#039;JSONList&#039;) is always a valid regular array, and I think it should be treated as such, rather than just returning typeof == &#039;json&#039;.  Most of the time I create and read JSON, I don&#039;t have to santitize it because it is internal, and I know what I&#039;m doing.
.
Otherwise, when I&#039;m worried about JSON input, I can use a library to parse and encode the data as I see fit.  Now, I think the &lt;em&gt;library&lt;/em&gt; should throw an error when encoding or parsing a cyclical reference &lt;a href=&quot;http://wiki.ecmascript.org/doku.php?id=proposals:json_encoding_and_decoding&quot; rel=&quot;nofollow&quot;&gt;as proposed in the spec&lt;/a&gt;, but I see no reason the ECMAScript 4 spec should include JSON over any other data format.
.
Usually it is fastest for me to translate an entire JS object into or out of  JSON once, before or after transport, rather than doing a check on each individual part.  JS is very fast with native objects and arrays.  However if you do &lt;i&gt;need&lt;/i&gt; a JSON object type and want to sanitize input without regex&#039;d eval, there is this JSONLib.</description>
		<content:encoded><![CDATA[<p>Hello Hedgar,</p>
<p>.I agree that putting objects inside of arrays inside of JSON can be troublesome.  However, in the other direction, a valid JSON Array (or &#8216;JSONList&#8217;) is always a valid regular array, and I think it should be treated as such, rather than just returning typeof == &#8216;json&#8217;.  Most of the time I create and read JSON, I don&#8217;t have to santitize it because it is internal, and I know what I&#8217;m doing.<br />
.<br />
Otherwise, when I&#8217;m worried about JSON input, I can use a library to parse and encode the data as I see fit.  Now, I think the <em>library</em> should throw an error when encoding or parsing a cyclical reference <a href="http://wiki.ecmascript.org/doku.php?id=proposals:json_encoding_and_decoding" rel="nofollow">as proposed in the spec</a>, but I see no reason the ECMAScript 4 spec should include JSON over any other data format.<br />
.<br />
Usually it is fastest for me to translate an entire JS object into or out of  JSON once, before or after transport, rather than doing a check on each individual part.  JS is very fast with native objects and arrays.  However if you do <i>need</i> a JSON object type and want to sanitize input without regex&#8217;d eval, there is this JSONLib.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Hedger Wang</title>
		<link>http://ajaxian.com/archives/jsonlib-json-extensions-a-la-e4x/comment-page-1#comment-260651</link>
		<dc:creator>Hedger Wang</dc:creator>
		<pubDate>Fri, 18 Jan 2008 20:23:35 +0000</pubDate>
		<guid isPermaLink="false">http://ajaxian.com/?p=3222#comment-260651</guid>
		<description>Hi, Charles.
An valid Array is not always a valid JSON object.

For example in JavaScript:

var arr1 = [ window , document , document.body ];
var arr2 = [ 1 , {} , &#039;3&#039; ];

you can never call arr1.toJSONString().

Because it create a lot circular reference such as window.document.window.document.window.......which generates infinite JSONStrings.

JSON.put() should guarantee that only valid JSON type data can be set to another JSON object.</description>
		<content:encoded><![CDATA[<p>Hi, Charles.<br />
An valid Array is not always a valid JSON object.</p>
<p>For example in JavaScript:</p>
<p>var arr1 = [ window , document , document.body ];<br />
var arr2 = [ 1 , {} , '3' ];</p>
<p>you can never call arr1.toJSONString().</p>
<p>Because it create a lot circular reference such as window.document.window.document.window&#8230;&#8230;.which generates infinite JSONStrings.</p>
<p>JSON.put() should guarantee that only valid JSON type data can be set to another JSON object.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Charles</title>
		<link>http://ajaxian.com/archives/jsonlib-json-extensions-a-la-e4x/comment-page-1#comment-260650</link>
		<dc:creator>Charles</dc:creator>
		<pubDate>Fri, 18 Jan 2008 18:49:29 +0000</pubDate>
		<guid isPermaLink="false">http://ajaxian.com/?p=3222#comment-260650</guid>
		<description>&lt;blockquote&gt;The [[Put]] method...will only accept values of type JSON, JSONList, Date, boolean, string, number, or null.&lt;/blockquote&gt;
.
Excuse me?  So I can&#039;t put an array into JSON, I have to redefine my array as a new type, JSONList?  ...And then it loses its identity as an array, returning typeof as JSON, making it impossible to determine the difference between key/value pairs (an object) and a value list (an array)? ...And I lose my array methods, and have to deal with lists only with (a redefined in code, non-native) put and push, no pop or unshift, etc.?
.
BTW, JSON stands for JavaScript Object Notation.  &lt;b&gt;One can not possibly &quot;keep JSON out of JavaScript.&quot;&lt;/b&gt;  JSON often needs to be sanitized or used securely, just like SQL statements or any other data exchange format.
.
I&#039;ll take uh, JavaScript&#039;s native support for JSON, thanks.  One of the strengths of JS is that everything can be expressed as an object, and therefore basically can be translated into JSON.  I only want to be forced into slow safe parsing when it&#039;s necessary for security, not every time I define a variable with JSON.</description>
		<content:encoded><![CDATA[<blockquote><p>The [[Put]] method&#8230;will only accept values of type JSON, JSONList, Date, boolean, string, number, or null.</p></blockquote>
<p>.<br />
Excuse me?  So I can&#8217;t put an array into JSON, I have to redefine my array as a new type, JSONList?  &#8230;And then it loses its identity as an array, returning typeof as JSON, making it impossible to determine the difference between key/value pairs (an object) and a value list (an array)? &#8230;And I lose my array methods, and have to deal with lists only with (a redefined in code, non-native) put and push, no pop or unshift, etc.?<br />
.<br />
BTW, JSON stands for JavaScript Object Notation.  <b>One can not possibly &#8220;keep JSON out of JavaScript.&#8221;</b>  JSON often needs to be sanitized or used securely, just like SQL statements or any other data exchange format.<br />
.<br />
I&#8217;ll take uh, JavaScript&#8217;s native support for JSON, thanks.  One of the strengths of JS is that everything can be expressed as an object, and therefore basically can be translated into JSON.  I only want to be forced into slow safe parsing when it&#8217;s necessary for security, not every time I define a variable with JSON.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Steve Clay</title>
		<link>http://ajaxian.com/archives/jsonlib-json-extensions-a-la-e4x/comment-page-1#comment-260642</link>
		<dc:creator>Steve Clay</dc:creator>
		<pubDate>Fri, 18 Jan 2008 14:58:50 +0000</pubDate>
		<guid isPermaLink="false">http://ajaxian.com/?p=3222#comment-260642</guid>
		<description>Not crazy about the implementation, but I do agree that rolling JSON support into ECMAscript seems dirty. I&#039;d think HTTP would be much more of a bottleneck than JSON.js.</description>
		<content:encoded><![CDATA[<p>Not crazy about the implementation, but I do agree that rolling JSON support into ECMAscript seems dirty. I&#8217;d think HTTP would be much more of a bottleneck than JSON.js.</p>
]]></content:encoded>
	</item>
</channel>
</rss>

