<?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"
	>

<channel>
	<title>JSON</title>
	<atom:link href="http://www.json.com/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.JSON.Com</link>
	<description>Developing the next generation of open data interchange</description>
	<pubDate>Tue, 18 Nov 2008 03:43:28 +0000</pubDate>
	<generator>http://wordpress.org/?v=2.5.1</generator>
	<language>en</language>
			<item>
		<title>New JSONQuery Implementation</title>
		<link>http://www.JSON.Com/2008/11/17/new-jsonquery-implementation/</link>
		<comments>http://www.JSON.Com/2008/11/17/new-jsonquery-implementation/#comments</comments>
		<pubDate>Tue, 18 Nov 2008 03:43:28 +0000</pubDate>
		<dc:creator>Kris Zyp</dc:creator>
		
		<category><![CDATA[Uncategorized]]></category>

		<guid isPermaLink="false">http://www.JSON.Com/?p=84</guid>
		<description><![CDATA[Jason Smith recently created a standalone JavaScript implementation of JSONQuery, based on the version I created for Dojo.
]]></description>
			<content:encoded><![CDATA[<p><a href="http://github.com/JasonSmith/" onclick="javascript:urchinTracker ('/outbound/article/github.com');">Jason Smith</a> recently created a standalone <a href="http://github.com/JasonSmith/jsonquery/tree/master" onclick="javascript:urchinTracker ('/outbound/article/github.com');">JavaScript implementation of JSONQuery</a>, based on the <a href="http://www.sitepen.com/blog/2008/07/16/jsonquery-data-querying-beyond-jsonpath/" onclick="javascript:urchinTracker ('/outbound/article/www.sitepen.com');">version</a> I created for <a href="http://dojotoolkit.org" onclick="javascript:urchinTracker ('/outbound/article/dojotoolkit.org');">Dojo</a>.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.JSON.Com/2008/11/17/new-jsonquery-implementation/feed/</wfw:commentRss>
		</item>
		<item>
		<title>Imperative, Functional, and Declarative Programming</title>
		<link>http://www.JSON.Com/2008/11/08/imperative-functional-and-declarative-programming/</link>
		<comments>http://www.JSON.Com/2008/11/08/imperative-functional-and-declarative-programming/#comments</comments>
		<pubDate>Sat, 08 Nov 2008 05:09:34 +0000</pubDate>
		<dc:creator>Kris Zyp</dc:creator>
		
		<category><![CDATA[General]]></category>

		<guid isPermaLink="false">http://www.JSON.Com/?p=83</guid>
		<description><![CDATA[Much of the efforts in modern programming language evolution are focused on moving beyond the low level programming paradigm of imperative programming and into the realm of functional and declarative programming. Imperative programming is simplest way to interact with hardware and generally forms the foundation of higher level constructs. However imperative programming is highly error-prone [...]]]></description>
			<content:encoded><![CDATA[<p>Much of the efforts in modern programming language evolution are focused on moving beyond the low level programming paradigm of imperative programming and into the realm of functional and declarative programming. Imperative programming is simplest way to interact with hardware and generally forms the foundation of higher level constructs. However imperative programming is highly error-prone approach to programming and can obstruct optimizations and implementation opportunities that better abstractions provide.</p>
<p>Functional programming focuses on computations and aims to minimize mutating states. Functional programming avoids side-effects and changing data as the basis for operations. Many computations that might rely on changing variables and state information in imperative programming, can be described in terms of mathematical computations in functional programming. Functional programming may rely on imperative steps in the implementations, but these imperative actions are ideally abstracted. For example, lets take a simple loop that finds all the objects in an array with a price property under 10. In imperative programming, this would be:</p>
<pre lang="javascript">
function bestPrices(inputArray){
  var outputArray = [];
  for(var i = 0; i &lt; inputArray.length; i++){
    if(inputArray[i].price&lt;10){
      outputArray.push(inputArray[i]);
    }
  }
  return outputArray;
}
</pre>
<p>Can you spot the state mutations that we had to induce in this imperative approach? For each loop we had to modify <code>i</code> (increment it) and for each match we had to modify <code>outputArray</code> (push appends a value to it).</p>
<p>Now if we use a more functional approach:</p>
<pre lang="javascript">
function bestPrices(inputArray){
  return Array.filter(inputArray, function(value){
    return value.price &lt; 10;
  }
}
</pre>
<p>This code is completely free of side-effects. We simply described the operation in the form of expressions. The underlying implementation hides all the imperative actions necessary to make this work.</p>
<p>Declarative programming is defined as programming in terms of  &quot;what&quot; instead of &quot;how&quot;. Functional programming can be categorized as a form of declarative programming since we describe &quot;what&quot; computation should take place with expressions, instead of describing how the computation should be performed in a series of steps as in imperative programming. However, the declarative programming concept goes beyond just functional programming.</p>
<p>One of the central aspects of most applications is persisting data. A core service that most applications provide to users is to be able to store information relating to the use of the application. A social networking application is useless if it can&#8217;t actually remember anything about you and your friends. The functional paradigm is limited here, it&#8217;s methodology stands in complete opposition to the central goal of the application. Quite simply, applications must deal with mutating states and data. Here we can still apply declarative programming concepts, describing what the data is, instead of how it was created or how we modify it. Perhaps the most critical and invaluable benefit of declarative programming is that the <strong>representation of &quot;what&quot; the object implicitly dictates&quot;how&quot; the object is modified</strong> . With a declarative approach there is no need for describing how we interact with and modify data, because the structure of the data reveals the how without any further instruction.</p>
<p>JSON provides a great example of declarative programming. JavaScript supports numerous imperative techniques, but JSON is a declarative subset, which precisely defines what an object&#8217;s state should be without directions on how to get it there. For example, we could use imperative techniques:</p>
<pre lang="javascript">
var movie = new Object();
movie.title=&quot;Transsiberan&quot;;
movie[&quot;rat&quot; + &quot;ing&quot;] = 1+2;
movie.setHowLong = function(len){
  this.length = len.trim();
}
movie.setHowLong(&quot;2 hours  &quot;);
</pre>
<p>This representation describes how to build the state of the object, and can be of unbounded complexity, but it is not actually a representation of the final state. Alternately with JSON:</p>
<pre lang="javascript">
{&quot;title&quot;:Transsineran&quot;,
&quot;rating&quot;:3,
&quot;length:&quot;2 hours&quot;}
</pre>
<p>The application of the concept of representation implicitly defining the method of modification can be seen here in the simple JavaScript object. The object&#8217;s state is observable as a set of properties and we can immediately infer from the presence of these properties how we modify the objects. We can simply set one of the existing properties to modify the state, and the effect of setting a property is obvious. Conversely, when an imperative approach where opaque object methods are used to modify an object&#8217;s state, the effects are not inferrable, one has to refer to out-of-band documentation to understand the interaction necessary to cause a state change.</p>
<p>The other central concept of a declarative approach to data is <strong>reversibility</strong> . If we modify the state of this movie object, there is a clear unambiguous easily computable representation for the new state of the object with a declarative definition. However, this is not true with the imperative definition. With the unbounded complexity possibilities of the imperative representation, it is impossible to always know exactly when step in the directions needs to modified to correspond the state change.</p>
<p>Another example of declarative programming is HTML. HTML represents the state of the layout of the page. The steps for how to get into a particular layout are not described, the layout is a state that is represented by the HTML. HTML provides clear reversibility as well. Layout changes can be clearly and directly mapped to changes in the HTML representation.</p>
<p>Applications themselves are a form of state as well, both at the low level (code is occupies memory in the form of binary data) and at the high level in languages that reify code. JavaScript is an example of an language where code is data. Here as well, we can benefit from code being organized in declarative approach rather than an imperative approach. An application runtime state that is the result of confusing imperative steps is much more difficult to debug than application that has a clear declarative organization.</p>
<p>Furthermore, declarative programming can often allow programmers to work within a &quot;live&quot; interactive environment, where code can be changed on the fly without requiring a restart. Imperative programming often means that the only way to predictably see the effect of a change in imperative code is to restart. We certainly want to be able to move towards faster development techniques that aren&#8217;t stuck in windows-style &quot;restart&quot; cycles.</p>
<p>Once again, declarative programming can be built on imperative programming. If strict discipline of rules is applied to imperative steps, the consistency can yield an declarative form in the context of rules. For example, if we said that all class declarations must take the form assigning a constructor function to a variable and then assigning an JSON object to the constructor&#8217;s prototype, then within the context of these rules, we can have a reversible representation that still be used even if we change the state of the class (changing method implementations for example).</p>
<p>It is important that these principles be used to direct our continuing evolution of JavaScript. Techniques like pseudo-classes based on the side-effects within constructor function execution are a regression in the evolution away from imperative to declarative. Prototype-based inheritance does a great job of maintaining declarative programming, as the application itself can be continually updated in interactive code. Debugging can be &quot;live&quot;, classes can be evolved without requiring environmental restarts.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.JSON.Com/2008/11/08/imperative-functional-and-declarative-programming/feed/</wfw:commentRss>
		</item>
		<item>
		<title>JSON vs Flash AMF</title>
		<link>http://www.JSON.Com/2008/11/05/json-vs-flash-amf/</link>
		<comments>http://www.JSON.Com/2008/11/05/json-vs-flash-amf/#comments</comments>
		<pubDate>Thu, 06 Nov 2008 00:25:33 +0000</pubDate>
		<dc:creator>Kris Zyp</dc:creator>
		
		<category><![CDATA[Uncategorized]]></category>

		<guid isPermaLink="false">http://www.JSON.Com/?p=82</guid>
		<description><![CDATA[Jared Jurkiewicz posted an excellent and thorough article debunking the myth that Flash&#8217;s AMF is signficantly faster than JSON. JSON is shown to be efficient and performant, and as Jared pointed out, it is not tied to any specific type system. AMF is also a binary format, whereas JSON is a highly open and readable [...]]]></description>
			<content:encoded><![CDATA[<p><a href="http://dojotoolkit.org/blog/jaredj" onclick="javascript:urchinTracker ('/outbound/article/dojotoolkit.org');">Jared Jurkiewicz</a> posted an excellent and <a href="http://dojotoolkit.org/2008/11/05/flash-flex-versus-open-web-ajax" onclick="javascript:urchinTracker ('/outbound/article/dojotoolkit.org');">thorough article debunking the myth</a> that Flash&#8217;s AMF is signficantly faster than JSON. JSON is shown to be efficient and performant, and as Jared pointed out, it is not tied to any specific type system. AMF is also a binary format, whereas JSON is a highly open and readable format.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.JSON.Com/2008/11/05/json-vs-flash-amf/feed/</wfw:commentRss>
		</item>
		<item>
		<title>New JSON-RPC Library for PHP</title>
		<link>http://www.JSON.Com/2008/10/27/new-json-rpc-library-for-php/</link>
		<comments>http://www.JSON.Com/2008/10/27/new-json-rpc-library-for-php/#comments</comments>
		<pubDate>Tue, 28 Oct 2008 04:58:58 +0000</pubDate>
		<dc:creator>Kris Zyp</dc:creator>
		
		<category><![CDATA[Uncategorized]]></category>

		<guid isPermaLink="false">http://www.JSON.Com/?p=80</guid>
		<description><![CDATA[Matthew Morley has posted his PHP library for JSON-RPC 2.0 .
]]></description>
			<content:encoded><![CDATA[<p>Matthew Morley has posted his <a href="http://code.google.com/p/jsonrpc2php/" onclick="javascript:urchinTracker ('/outbound/article/code.google.com');">PHP library for JSON-RPC 2.0</a> .</p>
]]></content:encoded>
			<wfw:commentRss>http://www.JSON.Com/2008/10/27/new-json-rpc-library-for-php/feed/</wfw:commentRss>
		</item>
		<item>
		<title>Dojo 1.2 Released</title>
		<link>http://www.JSON.Com/2008/10/27/dojo-12-released/</link>
		<comments>http://www.JSON.Com/2008/10/27/dojo-12-released/#comments</comments>
		<pubDate>Tue, 28 Oct 2008 04:54:53 +0000</pubDate>
		<dc:creator>Kris Zyp</dc:creator>
		
		<category><![CDATA[Uncategorized]]></category>

		<guid isPermaLink="false">http://www.JSON.Com/?p=79</guid>
		<description><![CDATA[Dojo 1.2 was released a few weeks ago, and I am really excited about this release. Take a look at the release notes to see all the new features added. This release includes a comprehensive set of new JSON features including JSONQuery , JSON Referencing , JSON Schema , and a RESTful JSON client . [...]]]></description>
			<content:encoded><![CDATA[<p><a href="http://dojotoolkit.org" onclick="javascript:urchinTracker ('/outbound/article/dojotoolkit.org');">Dojo</a> 1.2 was released a few weeks ago, and I am really excited about this release. Take a look at the <a href="http://dojotoolkit.org/book/dojo-1-2-release-notes" onclick="javascript:urchinTracker ('/outbound/article/dojotoolkit.org');">release notes</a> to see all the new features added. This release includes a comprehensive set of new JSON features including <a href="http://www.sitepen.com/blog/2008/07/16/jsonquery-data-querying-beyond-jsonpath/" onclick="javascript:urchinTracker ('/outbound/article/www.sitepen.com');">JSONQuery</a> , <a href="http://www.sitepen.com/blog/2008/06/17/json-referencing-in-dojo/" onclick="javascript:urchinTracker ('/outbound/article/www.sitepen.com');">JSON Referencing</a> , <a href="http://www.json.com/json-schema-proposal/" >JSON Schema</a> , and a <a href="http://www.sitepen.com/blog/2008/06/13/restful-json-dojo-data/" onclick="javascript:urchinTracker ('/outbound/article/www.sitepen.com');">RESTful JSON client</a> . I am think it is great to see the expanding JSON toolset available in JavaScript libraries.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.JSON.Com/2008/10/27/dojo-12-released/feed/</wfw:commentRss>
		</item>
		<item>
		<title>Persevere is now a Dojo Foundation Project</title>
		<link>http://www.JSON.Com/2008/10/27/persevere-is-now-a-dojo-foundation-project/</link>
		<comments>http://www.JSON.Com/2008/10/27/persevere-is-now-a-dojo-foundation-project/#comments</comments>
		<pubDate>Tue, 28 Oct 2008 04:44:48 +0000</pubDate>
		<dc:creator>Kris Zyp</dc:creator>
		
		<category><![CDATA[Announcement]]></category>

		<guid isPermaLink="false">http://www.JSON.Com/?p=77</guid>
		<description><![CDATA[Persevere , the JSON storage and JavaScript application server, was  recently accepted as a Dojo foundation project. Like other Open Source  foundations, the Dojo Foundation provides infrastructure for development,  shields individual contributors from liability, and helps to ensure that project  communities are healthy and successful. The Dojo Foundation is not equivalent [...]]]></description>
			<content:encoded><![CDATA[<div><span style="font-family: Arial; font-size: x-small;"><a href="http://code.google.com/p/persevere-framework/" onclick="javascript:urchinTracker ('/outbound/article/code.google.com');">Persevere</a> , the JSON storage and JavaScript application server, was  recently accepted as a <a href="http://dojofoundation.org" onclick="javascript:urchinTracker ('/outbound/article/dojofoundation.org');">Dojo foundation</a> project. Like other Open Source  foundations, the Dojo Foundation provides infrastructure for development,  shields individual contributors from liability, and helps to ensure that project  communities are healthy and successful. The Dojo Foundation is not equivalent to  the <a href="http://dojotoolkit.org" onclick="javascript:urchinTracker ('/outbound/article/dojotoolkit.org');">Dojo Toolkit</a> (the JavaScript library); this does not mean that Persevere  will only work with Dojo. Persevere will continue to utilize open protocols and  standards-based mechanisms for maximum interoperability with other libraries,  both on the client and server side. This does mean that Persevere will have a  stable solid infrastructure for future contributors and community interaction, and hopefully will provide a great open project for the community to build and improve on a comprehensive JSON storage server.<br />
</span></div>
]]></content:encoded>
			<wfw:commentRss>http://www.JSON.Com/2008/10/27/persevere-is-now-a-dojo-foundation-project/feed/</wfw:commentRss>
		</item>
		<item>
		<title>JavaScript Expressions - Beyond JSON</title>
		<link>http://www.JSON.Com/2008/09/22/javascript-expressions-beyond-json/</link>
		<comments>http://www.JSON.Com/2008/09/22/javascript-expressions-beyond-json/#comments</comments>
		<pubDate>Mon, 22 Sep 2008 16:55:10 +0000</pubDate>
		<dc:creator>Kris Zyp</dc:creator>
		
		<category><![CDATA[Ajax]]></category>

		<category><![CDATA[Libraries]]></category>

		<guid isPermaLink="false">http://www.JSON.Com/?p=78</guid>
		<description><![CDATA[JSON a powerful simple expressive format for data structures with a high level of interoperability; implementations exist in virtually every popular language. However, there are certainly situations where developers often want additional constructs for effectively representing data that are not natively supported in JSON. Perhaps the most common usage of JSON is for the consumption [...]]]></description>
			<content:encoded><![CDATA[<p>JSON a powerful simple expressive format for data structures with a high level of interoperability; implementations exist in virtually every popular language. However, there are certainly situations where developers often want additional constructs for effectively representing data that are not natively supported in JSON. Perhaps the most common usage of JSON is for the consumption of data in the browser. Most JavaScript libraries, parse JSON by using eval, and consequently are actually capable of full JavaScript expression evaluation, of which JSON is a subset. JavaScript expressions support a much wider range of constructs than pure JSON. Usually a simple JSON/JavaScript expression parser looks like:</p>
<pre lang="javascript">
function parseJson(jsonText){
  return eval('(' + jsonText + ')');
}
</pre>
<p>One of the most oft-desired data type that JSON doesn&#8217;t provide is a date type. Numerous <a href="http://www.aptana.com/reference/jaxer/api/Jaxer.Serialization.html" onclick="javascript:urchinTracker ('/outbound/article/www.aptana.com');">creative</a>, <a href="http://msdn.microsoft.com/en-us/library/bb299886.aspx" onclick="javascript:urchinTracker ('/outbound/article/msdn.microsoft.com');">bizarre</a>, <a href="http://weblogs.asp.net/bleroy/archive/2008/01/18/dates-and-json.aspx" onclick="javascript:urchinTracker ('/outbound/article/weblogs.asp.net');">weird</a>, and <a href="http://dojotoolkit.org/pipermail/dojo-interest/2006-July/012311.html" onclick="javascript:urchinTracker ('/outbound/article/dojotoolkit.org');">silly</a> techniques have been proposed for expressing dates in JavaScript. These methods often require extra parsing or walking strategies. Douglas Crockford&#8217;s <a href="http://json.org/json2.js" onclick="javascript:urchinTracker ('/outbound/article/json.org');">reference library for JavaScript JSON serialization</a>, serializes dates to strings by ISO format.  I have written about <a href="http://www.json.com/2007/10/24/lossless-json-dates/" >deserializing these ISO dates</a>. But, on deserialization it is not possible to determine if a value is actually a string or is really intended to be an actual date object. However, if the recipient of JSON is known to support full JavaScript evaluation (like the browser with a library using an eval), the solution for delivering date type value is simple, we can just use the normal JavaScript constructor:</p>
<pre lang="javascript">
{"mydate":new Date(1222057313264)}
</pre>
<p>There are also several numeric entities that JavaScript provides that are not available, including <code>Infinite</code>, <code>-Infinite</code>, and <code>NaN</code>. I am not sure why you would need it, but <code>undefined</code> can also be transferred with JavaScript. Functions can be included as well:</p>
<pre lang="javascript">
{
  "reallyBig": Infinite,
  "parsedString": NaN,
  "whatValue?": undefined,
  "doSomething":function(arg){return doSomethingElse{arg};}
}
</pre>
<p>The data representations thus demonstrated are not JSON, they are JavaScript using the same object/array literal that JSON is based on. However, certainly one of the biggest benefits of JSON is it&#8217;s interoperability. If your data is going to be consumed by more than just JavaScript-parsing JavaScript libraries, you must make your data available in pure JSON format as well. This is well-handled through content negotiation. If you are using JavaScript expressions to transfer data, you should make sure your requests from the browser actually are specifying they can handle JavaScript:</p>
<pre>
Accept: text/javascript
</pre>
<p>Your server should be prepared to handle requests from clients that indicate that they only understand pure JSON:</p>
<pre>
Accept: application/json
</pre>
<p><a href="http://sitepen.com/labs/persevere.php" onclick="javascript:urchinTracker ('/outbound/article/sitepen.com');">Persevere</a>, the JavaScript/JSON application and storage server, also provides support for parsing and storing extra constructs including non-finite numbers (NaN, Infinite), functions. Persevere can output the data as JSON or JavaScript (expression).</p>
<p>JSON is certainly powerful, expressive data format. This post is by no means an attempt to expand or lobby for the modification JSON. However, when it is known that consumers are actually JavaScript capable clients, it can often be advantageous to use the full power of JavaScript to represent data, while still providing JSON as representation for non-JavaScript capable clients.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.JSON.Com/2008/09/22/javascript-expressions-beyond-json/feed/</wfw:commentRss>
		</item>
		<item>
		<title>New JSON-RPC Python Library</title>
		<link>http://www.JSON.Com/2008/09/02/new-json-rpc-python-library/</link>
		<comments>http://www.JSON.Com/2008/09/02/new-json-rpc-python-library/#comments</comments>
		<pubDate>Wed, 03 Sep 2008 03:00:14 +0000</pubDate>
		<dc:creator>Kris Zyp</dc:creator>
		
		<category><![CDATA[Announcement]]></category>

		<category><![CDATA[Libraries]]></category>

		<guid isPermaLink="false">http://www.JSON.Com/?p=76</guid>
		<description><![CDATA[Roland Koebler has just released a new JSON-RPC module for Python . jsonrpc.py implements both JSON-RPC 1.0 and JSON-RPC 2.0 .
]]></description>
			<content:encoded><![CDATA[<p><a href="http://roland.koebler.com" onclick="javascript:urchinTracker ('/outbound/article/roland.koebler.com');">Roland Koebler</a> has just released a new <a href="http://roland.koebler.com/rpc/" onclick="javascript:urchinTracker ('/outbound/article/roland.koebler.com');">JSON-RPC module for Python</a> . jsonrpc.py implements both <a href="http://json-rpc.org" onclick="javascript:urchinTracker ('/outbound/article/json-rpc.org');">JSON-RPC</a> 1.0 and <a href="http://groups.google.com/group/json-rpc/web/json-rpc-1-2-proposal" onclick="javascript:urchinTracker ('/outbound/article/groups.google.com');">JSON-RPC 2.0</a> .</p>
]]></content:encoded>
			<wfw:commentRss>http://www.JSON.Com/2008/09/02/new-json-rpc-python-library/feed/</wfw:commentRss>
		</item>
		<item>
		<title>Dojo 1.2 Beta Available</title>
		<link>http://www.JSON.Com/2008/09/02/dojo-12-beta-available/</link>
		<comments>http://www.JSON.Com/2008/09/02/dojo-12-beta-available/#comments</comments>
		<pubDate>Tue, 02 Sep 2008 16:51:30 +0000</pubDate>
		<dc:creator>Kris Zyp</dc:creator>
		
		<category><![CDATA[Announcement]]></category>

		<category><![CDATA[Libraries]]></category>

		<category><![CDATA[Dojo]]></category>

		<category><![CDATA[json referencing]]></category>

		<category><![CDATA[rest]]></category>

		<guid isPermaLink="false">http://www.JSON.Com/?p=75</guid>
		<description><![CDATA[Dojo 1.2  beta 1 was just released today. I am particularly excited about this release because it includes JSON referencing support , the JsonRestStore module, a JSON-based client REST implementation , JSONQuery , the windowName module , Dojo Secure , and much more .
]]></description>
			<content:encoded><![CDATA[<div><span style="font-family: Arial; font-size: x-small;"><a href="http://dojotoolkit.org/2008/09/02/beta-time" onclick="javascript:urchinTracker ('/outbound/article/dojotoolkit.org');">Dojo 1.2  beta 1</a> was just released today. I am particularly excited about this release because it includes <a href="http://www.sitepen.com/blog/2008/06/17/json-referencing-in-dojo/" onclick="javascript:urchinTracker ('/outbound/article/www.sitepen.com');">JSON referencing support</a> , the <a href="http://www.sitepen.com/blog/2008/06/13/restful-json-dojo-data/" onclick="javascript:urchinTracker ('/outbound/article/www.sitepen.com');">JsonRestStore module, a JSON-based client REST implementation</a> , <a href="http://www.sitepen.com/blog/2008/07/16/jsonquery-data-querying-beyond-jsonpath/" onclick="javascript:urchinTracker ('/outbound/article/www.sitepen.com');">JSONQuery</a> , the <a href="http://www.sitepen.com/blog/2008/07/22/windowname-transport/" onclick="javascript:urchinTracker ('/outbound/article/www.sitepen.com');">windowName module</a> , <a href="http://www.sitepen.com/blog/2008/08/01/secure-mashups-with-dojoxsecure/" onclick="javascript:urchinTracker ('/outbound/article/www.sitepen.com');">Dojo Secure</a> , and <a href="http://dojotoolkit.org/book/dojo-1-2-release-notes" onclick="javascript:urchinTracker ('/outbound/article/dojotoolkit.org');">much more</a> .</span></div>
]]></content:encoded>
			<wfw:commentRss>http://www.JSON.Com/2008/09/02/dojo-12-beta-available/feed/</wfw:commentRss>
		</item>
		<item>
		<title>Standardizing RESTful JSON</title>
		<link>http://www.JSON.Com/2008/08/19/standardizing-restful-json/</link>
		<comments>http://www.JSON.Com/2008/08/19/standardizing-restful-json/#comments</comments>
		<pubDate>Tue, 19 Aug 2008 20:48:08 +0000</pubDate>
		<dc:creator>Kris Zyp</dc:creator>
		
		<category><![CDATA[Ajax]]></category>

		<category><![CDATA[JSON Schema]]></category>

		<guid isPermaLink="false">http://www.JSON.Com/?p=72</guid>
		<description><![CDATA[Joe Gregorio recently began discussing a protocol for RESTful JSON . Having spent a significant amount of time in this field, and having authored several implementations of RESTful JSON, I thought it me be beneficial to offer some comments on the subject. I am certainly supportive of Joe&#8217;s efforts towards RESTful JSON, and believe this [...]]]></description>
			<content:encoded><![CDATA[<p><a href="http://bitworking.org/" onclick="javascript:urchinTracker ('/outbound/article/bitworking.org');">Joe Gregorio</a> recently began discussing a <a href="http://bitworking.org/news/358/restful-json" onclick="javascript:urchinTracker ('/outbound/article/bitworking.org');">protocol for RESTful JSON</a> . Having spent a significant amount of time in this field, and having authored several implementations of RESTful JSON, I thought it me be beneficial to offer some comments on the subject. I am certainly supportive of Joe&#8217;s efforts towards RESTful JSON, and believe this could be very valuable for the community. Clearly defining the mechanisms for JSON-based RESTful interchange would surely improve interoperability of services and consumers. However, I think it worthwhile to mention some suggestions for this effort.</p>
<p>One of the most important keys to positive successful standardization is not to <a href="http://yuiblog.com/blog/2008/08/14/premature-standardization/" onclick="javascript:urchinTracker ('/outbound/article/yuiblog.com');">prematurly standardize on new inventions</a> . Fortunately RESTful JSON is not a new invention, and implementations have forged the way of leveraging and interpreting existing standards and creating conventions as necessary. Any standardization should stand on the shoulders of these efforts.<a href="http://jspon.org" onclick="javascript:urchinTracker ('/outbound/article/jspon.org');"> Initial attempts</a> at CRUD-style JSON-based interaction were quite inventive, but inventiveness is not the friend of interoperability when standards already exist (de facto or formal), and HTTP provides a comprehensive set of mechanisms for data interaction. For many forms of data interaction, the intuitive combination of JSON and HTTP provides a high level of power. Many JSON-REST implementations mostly follow the HTTP specification, and often multiple implementations share common conventions. The notes in this post are based on the behavior of server implementations of JSON REST including <a href="http://sitepen.com/labs/persevere.php" onclick="javascript:urchinTracker ('/outbound/article/sitepen.com');">Persevere</a> , <a href="http://incubator.apache.org/couchdb/" onclick="javascript:urchinTracker ('/outbound/article/incubator.apache.org');">CouchDB</a> , <a href="http://code.google.com/p/grassyknoll/" onclick="javascript:urchinTracker ('/outbound/article/code.google.com');">GrassyKnoll</a> , Amazon S3, and <a href="http://ryandaigle.com/articles/2007/3/14/rest-activeresource" onclick="javascript:urchinTracker ('/outbound/article/ryandaigle.com');">RoR&#8217;s ActiveResource</a> , and on client implementations including <a href="http://dojotoolkit.org" onclick="javascript:urchinTracker ('/outbound/article/dojotoolkit.org');">Dojo</a> , <a href="http://giantrobots.thoughtbot.com/2007/4/2/jester-javascriptian-rest" onclick="javascript:urchinTracker ('/outbound/article/giantrobots.thoughtbot.com');">Jester</a> , and <a href="http://code.google.com/p/persevere-framework/" onclick="javascript:urchinTracker ('/outbound/article/code.google.com');">Persevere JavaScript client</a> .</p>
<p>Another key aspect to establishing a JSON REST protocol is to properly define and distinguish the orthogonal concerns involved. Basic JSON interchange using REST is actually well-specified in the HTTP, but applications often want higher level constructs for effective interaction. Various applications need different features, and they should be able to retain maximum simplicity without overhead from unnecessary constructs. Some of JSON protocols are certainly not specific to RESTful usage. Here is how I would characterize the different components that may be of interest to different RESTful JSON applications:</p>
<ul>
<li>Object identity to URL mapping - This is the critical protocol necessary for allowing JSON messages to contain object/sub-resources that can be addressed through REST verbs with URLs. A convention is necessary for determing how any given object is mapped to a URL. Every JSON REST implementation that I am aware defines an identity property and uses that identity to map to URL in the form:
<pre>/table/id</pre>
<p>Or tableless stores will just do:</p>
<pre>/id</pre>
<p>It is certainly possible to create more sophisticated URL mapping schemes with multiple identity properties and alternate URL forms. Most simplicity driven JSON advocates would and probably should reject such complications.</li>
<li>Data structure definition - <a href="http://json-schema.org" onclick="javascript:urchinTracker ('/outbound/article/json-schema.org');">JSON Schema</a> seems to be emerging as the protocol for defining JSON structures.</li>
<li>Service advertising - This defines a protocol for the a server to advertise it&#8217;s services. <a href="http://groups.google.com/group/json-schema/web/service-mapping-description-proposal" onclick="javascript:urchinTracker ('/outbound/article/groups.google.com');">Service Method Description</a> builds on JSON Schema to do this effectively for JSON services.</li>
<li>Topology - Plain JSON is composed of simple directed object graphs. Applications that need more sophisticated property linking can utilize <a href="http://www.sitepen.com/blog/2008/06/17/json-referencing-in-dojo/" onclick="javascript:urchinTracker ('/outbound/article/www.sitepen.com');">JSON Referencing</a> for cyclic and cross-domain references. It should be noted that JSON Referencing is an exercise in minimal inventiveness as well, it is basically an application of the hyperlink/relative URL scheme to JSON data. Existing standards are leveraged.</li>
</ul>
<p>Of course these protocols are not completely orthogonal, JSON Referencing also utilizes object identities, and anticipates RESTful URLs for cross-site referencing lookups. JSON Schema can leverage referencing for describing sophisticated data structures, and can itself define identity properties.</p>
<p>I certainly would be happy to see these protocols standardized. However, my main concern is that a new uber protocol that invents a new techniques for all these concepts, and creates divergence between RESTful JSON usage and other JSON usage doesn&#8217;t seem like it would be good for the community. Simply taking a single example use case and lumping all of the needs into a single specification is certainly not a wise course. And most importantly standardizatin of RESTful JSON should be stand on the work of the current implementations, not invent new wheels and contradict the work and conventions that are currently in use today.</p>
<p>Another important concern is that a RESTful JSON protocol should not add signficant complexity. Complexity may be acceptable in other realms, but JSON pioneers have rightly fought for keeping things simple. RESTful web services should be able to simply provide data in the form that it exists. For example if I want to return a set of users, it should be as simple as returning:</p>
<pre>[{&quot;name&quot;:&quot;Kris&quot;, &quot;gender&quot;:&quot;male&quot;, &quot;id&quot;:&quot;1&quot;},
{&quot;name&quot;:&quot;Nicole&quot;, &quot;gender&quot;:&quot;female&quot;, &quot;id&quot;:&quot;2&quot;}]</pre>
<p>A RESTful JSON protocol is not the place to force developers to wrap everything in envelopes or force extraneous additional metadata in objects.</p>
<p>Finally here is a simple example of combining HTTP REST with JSON Schema providing comprehensive data structure knowledge for full interaction:</p>
<p>Here is an example of we have been doing it:</p>
<pre>GET /Trail</pre>
<pre>response:
{
    name:&quot;A database of trails&quot;,
    properties:{
        name:{type:&quot;string&quot;},
        description:{type:&quot;string&quot;},
        id:{type:&quot;string&quot;,unique:true},
        length:{type:&quot;number&quot;},
        ...
    }
}</pre>
<p>And then getting an object:</p>
<pre>GET /Trail/3</pre>
<pre>response:</pre>
<pre>{
    id:&quot;3&quot;,
    name:&quot;Wasatch Crest Trail&quot;,
    description:&quot;Follows the ridgeline of the Wasatch mts&quot;,
    length:3,
...
}</pre>
<p>Likewise we can intuitively PUT or DELETE to /Trail/3.</p>
<p>I hope we can together make progress towards a standard RESTful JSON protocol that is useful for the community, but I believe this can only be done if we keep things simple and build upon what has been done by existing implementations. I believe we have a great foundation for future progress.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.JSON.Com/2008/08/19/standardizing-restful-json/feed/</wfw:commentRss>
		</item>
	</channel>
</rss>

<!-- Dynamic Page Served (once) in 0.890 seconds -->
