<?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: Using JSON for Language-independent Configuration Files</title>
	<atom:link href="http://www.sitepoint.com/blogs/2008/08/21/using-json-for-language-independent-configuration-files/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.sitepoint.com/blogs/2008/08/21/using-json-for-language-independent-configuration-files/</link>
	<description>News, opinion, and fresh thinking for web developers and designers. The official podcast of sitepoint.com.</description>
	<lastBuildDate>Sat, 07 Nov 2009 23:35:20 -0500</lastBuildDate>
	<generator>http://wordpress.org/?v=2.8.4</generator>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
		<item>
		<title>By: El Guapo</title>
		<link>http://www.sitepoint.com/blogs/2008/08/21/using-json-for-language-independent-configuration-files/comment-page-1/#comment-852313</link>
		<dc:creator>El Guapo</dc:creator>
		<pubDate>Sun, 21 Dec 2008 18:09:16 +0000</pubDate>
		<guid isPermaLink="false">http://www.sitepoint.com/blogs/?p=2868#comment-852313</guid>
		<description>To anonymous aka bob,

I disagree. XML is a lot heavier to deal with. Have you ever done parsing in Java for instance? That small amount of PHP is ridiculously simple in comparison.

For many tasks, JSON is an excellent choice of format. Configuration files are one of them.</description>
		<content:encoded><![CDATA[<p>To anonymous aka bob,</p>
<p>I disagree. XML is a lot heavier to deal with. Have you ever done parsing in Java for instance? That small amount of PHP is ridiculously simple in comparison.</p>
<p>For many tasks, JSON is an excellent choice of format. Configuration files are one of them.</p>]]></content:encoded>
	</item>
	<item>
		<title>By: brothercake</title>
		<link>http://www.sitepoint.com/blogs/2008/08/21/using-json-for-language-independent-configuration-files/comment-page-1/#comment-791586</link>
		<dc:creator>brothercake</dc:creator>
		<pubDate>Fri, 05 Sep 2008 00:30:50 +0000</pubDate>
		<guid isPermaLink="false">http://www.sitepoint.com/blogs/?p=2868#comment-791586</guid>
		<description>Nice pun :D On the flip side, wouldn&#039;t if be funny to have a kid and call him Json :)

But re: INI files - I wasn&#039;t aware there was actually a proscribed format for that; I thought it was just a plain-text file extension convention ..?</description>
		<content:encoded><![CDATA[<p>Nice pun :D On the flip side, wouldn&#8217;t if be funny to have a kid and call him Json :)</p>
<p>But re: INI files &#8211; I wasn&#8217;t aware there was actually a proscribed format for that; I thought it was just a plain-text file extension convention ..?</p>]]></content:encoded>
	</item>
	<item>
		<title>By: BartVG</title>
		<link>http://www.sitepoint.com/blogs/2008/08/21/using-json-for-language-independent-configuration-files/comment-page-1/#comment-791448</link>
		<dc:creator>BartVG</dc:creator>
		<pubDate>Thu, 04 Sep 2008 18:35:11 +0000</pubDate>
		<guid isPermaLink="false">http://www.sitepoint.com/blogs/?p=2868#comment-791448</guid>
		<description>But XML is obviously a better choice.</description>
		<content:encoded><![CDATA[<p>But XML is obviously a better choice.</p>]]></content:encoded>
	</item>
	<item>
		<title>By: BartVG</title>
		<link>http://www.sitepoint.com/blogs/2008/08/21/using-json-for-language-independent-configuration-files/comment-page-1/#comment-791447</link>
		<dc:creator>BartVG</dc:creator>
		<pubDate>Thu, 04 Sep 2008 18:33:41 +0000</pubDate>
		<guid isPermaLink="false">http://www.sitepoint.com/blogs/?p=2868#comment-791447</guid>
		<description>How about those good old INI-files? Apart from being a Windows invention (not entirely sure of this, though), their format is also well known and easy to read/parse. 

It’s true that Javascript can’t handle them as elegantly as JSON objects, but on the server side, there’s as much parsing needed for JSON objects as there is with INI files. (note: if this last sentence (the part after the last comma) is like a puzzle to you, it’s because I have a slight feeling that there’s something wrong with the word order. Or maybe not.)
I mean, one would expect to be able to do something like json_decode(‘config.js’), which would give you a beautiful associated array immediately, instead of having to read the file, removing possible comments, extracting the part between curly braces and finally calling the current json_decode (which imo does just some extra parsing: you could easily split the contents into an array yourself).
But you can of course always write your own json decoding function that does al this :-)
(I would call it: jason_decode, pun intended)</description>
		<content:encoded><![CDATA[<p>How about those good old INI-files? Apart from being a Windows invention (not entirely sure of this, though), their format is also well known and easy to read/parse. </p>
<p>It’s true that Javascript can’t handle them as elegantly as JSON objects, but on the server side, there’s as much parsing needed for JSON objects as there is with INI files. (note: if this last sentence (the part after the last comma) is like a puzzle to you, it’s because I have a slight feeling that there’s something wrong with the word order. Or maybe not.)<br />
I mean, one would expect to be able to do something like json_decode(‘config.js’), which would give you a beautiful associated array immediately, instead of having to read the file, removing possible comments, extracting the part between curly braces and finally calling the current json_decode (which imo does just some extra parsing: you could easily split the contents into an array yourself).<br />
But you can of course always write your own json decoding function that does al this :-)<br />
(I would call it: jason_decode, pun intended)</p>]]></content:encoded>
	</item>
	<item>
		<title>By: nickg</title>
		<link>http://www.sitepoint.com/blogs/2008/08/21/using-json-for-language-independent-configuration-files/comment-page-1/#comment-788140</link>
		<dc:creator>nickg</dc:creator>
		<pubDate>Fri, 29 Aug 2008 00:12:12 +0000</pubDate>
		<guid isPermaLink="false">http://www.sitepoint.com/blogs/?p=2868#comment-788140</guid>
		<description>nice idea.

though did notice

from developer.mozilla.org
&lt;blockquote&gt;
const is a Mozilla-specific extension, it is not supported by IE, but has been supported by Opera since version 9.0. 
&lt;/blockquote&gt;

so perhaps

&lt;code&gt;
var config = { 
  &quot;lang&quot; : &quot;en&quot;,
  &quot;host&quot; : &quot;sitepoint.com&quot;
}; 
&lt;/code&gt;

and your regex does not strip /* block style comments */

cheers
nick</description>
		<content:encoded><![CDATA[<p>nice idea.</p>
<p>though did notice</p>
<p>from developer.mozilla.org</p>
<blockquote><p>
const is a Mozilla-specific extension, it is not supported by IE, but has been supported by Opera since version 9.0.
</p></blockquote>
<p>so perhaps</p>
<code>
var config = { 
  "lang" : "en",
  "host" : "sitepoint.com"
}; 
</code>
<p>and your regex does not strip /* block style comments */</p>
<p>cheers<br />
nick</p>]]></content:encoded>
	</item>
	<item>
		<title>By: brothercake</title>
		<link>http://www.sitepoint.com/blogs/2008/08/21/using-json-for-language-independent-configuration-files/comment-page-1/#comment-787878</link>
		<dc:creator>brothercake</dc:creator>
		<pubDate>Thu, 28 Aug 2008 01:19:34 +0000</pubDate>
		<guid isPermaLink="false">http://www.sitepoint.com/blogs/?p=2868#comment-787878</guid>
		<description>But why use a format that *every* language has to parse, when you can use a format that some languages understand natively?

btw - JSON may have originally been a subset of javascript (or python, depending on your point of view), but it&#039;s fast on its way to being an independent specification, with its own RFC and mime-type -- http://www.ietf.org/rfc/rfc4627.txt</description>
		<content:encoded><![CDATA[<p>But why use a format that *every* language has to parse, when you can use a format that some languages understand natively?</p>
<p>btw &#8211; JSON may have originally been a subset of javascript (or python, depending on your point of view), but it&#8217;s fast on its way to being an independent specification, with its own RFC and mime-type &#8212; <a href="http://www.ietf.org/rfc/rfc4627.txt" rel="nofollow">http://www.ietf.org/rfc/rfc4627.txt</a></p>]]></content:encoded>
	</item>
	<item>
		<title>By: Andy_Read</title>
		<link>http://www.sitepoint.com/blogs/2008/08/21/using-json-for-language-independent-configuration-files/comment-page-1/#comment-787661</link>
		<dc:creator>Andy_Read</dc:creator>
		<pubDate>Wed, 27 Aug 2008 10:28:26 +0000</pubDate>
		<guid isPermaLink="false">http://www.sitepoint.com/blogs/?p=2868#comment-787661</guid>
		<description>This is a neat hack if you&#039;re a Javascript-centric developer, but beyond that it&#039;s conceptually quite misleading.  It&#039;s not a language-independent config file: it&#039;s a JSON config file, which is clearly not language independent - it&#039;s part of the Javascript language.  Just because you can get another language like PHP to read and parse a JSON file, doesn&#039;t stop it being Javascript.  I could make PHP read a C++ header file, but that wouldn&#039;t make it language-independent, either.

XML is the obvious format designed for language independent use on the web, but good old .ini files are just as language independent - they just require an equal amount of work to read, regardless of which language.</description>
		<content:encoded><![CDATA[<p>This is a neat hack if you&#8217;re a Javascript-centric developer, but beyond that it&#8217;s conceptually quite misleading.  It&#8217;s not a language-independent config file: it&#8217;s a JSON config file, which is clearly not language independent &#8211; it&#8217;s part of the Javascript language.  Just because you can get another language like PHP to read and parse a JSON file, doesn&#8217;t stop it being Javascript.  I could make PHP read a C++ header file, but that wouldn&#8217;t make it language-independent, either.</p>
<p>XML is the obvious format designed for language independent use on the web, but good old .ini files are just as language independent &#8211; they just require an equal amount of work to read, regardless of which language.</p>]]></content:encoded>
	</item>
	<item>
		<title>By: bob</title>
		<link>http://www.sitepoint.com/blogs/2008/08/21/using-json-for-language-independent-configuration-files/comment-page-1/#comment-784144</link>
		<dc:creator>bob</dc:creator>
		<pubDate>Thu, 21 Aug 2008 17:01:04 +0000</pubDate>
		<guid isPermaLink="false">http://www.sitepoint.com/blogs/?p=2868#comment-784144</guid>
		<description>I&#039;d just use XML, its way simpler than having to mess with all this crap.</description>
		<content:encoded><![CDATA[<p>I&#8217;d just use XML, its way simpler than having to mess with all this crap.</p>]]></content:encoded>
	</item>
	<item>
		<title>By: Anonymous</title>
		<link>http://www.sitepoint.com/blogs/2008/08/21/using-json-for-language-independent-configuration-files/comment-page-1/#comment-784143</link>
		<dc:creator>Anonymous</dc:creator>
		<pubDate>Thu, 21 Aug 2008 17:00:45 +0000</pubDate>
		<guid isPermaLink="false">http://www.sitepoint.com/blogs/?p=2868#comment-784143</guid>
		<description>I&#039;d just use XML, its way simpler than having to mess with all this crap.</description>
		<content:encoded><![CDATA[<p>I&#8217;d just use XML, its way simpler than having to mess with all this crap.</p>]]></content:encoded>
	</item>
</channel>
</rss>
