Vishful thinking…

Thinking about JSON… Schema definition for JSON? RESTful presentation & transformation services for JSON?

Posted in Uncategorized by viswaug on May 11, 2008

Since I have been working with JSON, I have had a lot of ideas and questions regarding its use, validation and presentation. JSON is overwhelmingly being preferred over XML these days for most applications since most of them are web-based. Given its quick acceptance for various applications, do we need other supporting standards and technologies for JSON like XML’s XSD and XSLT technologies. When I was pouring over the GeoJSON standard when working on the GeoJSON.NET library, I couldn’t help but wonder if the GeoJSON standard should be expressed in a schema definition language for JSON like the XSD for XML. I don’t believe validating JSON data against such a schema definition would be practical right now, given that the validation will be processor and memory intensive and may not be a great idea on the client-side browsers. I did find Kwalify and Cerny which seem to take a stab at it. It will be interesting to see whether such technologies will develop further.

Another interesting area that is slowly progressing with JSON is technologies to convert JSON data into a user presentable format i.e. a XSLT like technology to convert JSON data to HTML. Some of my thoughts and performance metrics on some examples can be found here. Given that transforming large JSON data into HTML using JavaScript may not be as fast as required on the client-side, I believe this and other reasons will open up server-side RESTful services that do the job of transforming JSON into a user presentable format. To perform the transformation on the server-side, the amount of data being transformed should be substantially big. These RESTful JSON presentation services could look like the following

http://www.XXX.com/Presentation/?outputFormat=[HTML]&jsonDATA=[jsonURL]

In the above URL, the ‘[jsonURL]’ represents the URL that GETs the JSON data and ‘[HTML]’ tells the service the format to which the JSON data needs to be transformed to. I don’t think this kind of RESTful presentation services for data is anything new. There are similar services available right now even for GIS but not exactly JSON data. The service I am referring to is one of VirtualEarth’s services to view KML data(not GeoJSON, but hopefully that is coming soon). It should be a breeze to build a similar service for GeoJSON using OpenLayers since it can consume GeoJSON data directly as a layer. One example of an OpenLayers app consuming GeoJSON data can be found here. The GeoJSON data is obtained from here, which is a FeatureCollection of the boundary data for all countries.

Anyway, both these services take data in one format (KML and GeoJSON) and present it on a map.

URL FORMAT http://maps.live.com/?mapurl=[insert url here]

http://maps.live.com/?mapurl=http://dsc.discovery.com/utilities/googleearth/nationalparks/nationalparks.kml

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: