[xquery-talk] [xml-dev] JSON query processing

David Lee dlee at calldei.com
Sun Oct 16 09:40:17 PDT 2011



Alex Says
--------
I would think that JSON would generally be used to represent data
pulled out of a relational database to a website in which case the
structure of this data would be fairly trivial to move between JSON or
XML as suggested.

Which of these examples below are likely candidates for JSON
representation and why?
-=------------------

I disagree with your assumption that JSON is just used to render relational
data to a website.
It may have started out  that way but as the current generation of web
developers have adopted JSON they are starting to use it for *everything*.
Including, IMHO, places where it is entirely unreasonable.
A simple example I see in practice is using JSON strings to encode HTML
because JSON itself cant do mixed content in a pretty way.  Now you have to
have both a JSON parser AND an HTML parser to make sense out of it.   Works
fairly well in a browser where you have both ... but its particularly
tedious to generate and parse in any other environment.




But To answer your questions ... 
Here are a few examples that I think make sense.

HL7:   Since web developers want JSON,  a JSON representation of an HL7
document would be very useful to a EMR application.

XSD:   Would be great if there was the equivalent of XSD for JSON.  There's
a start of a spec but no implementations to my knowledge.  If you can
translate both XSLT *and* the corresponding XML docs to JSON then you  could
use existing XSLT processors to transform JSON without having to re-invent
to world.

 AWS API.  These are a weird blend of XML and JSON. (No idea why ...)   It
would be nice to stick to one markup and have some plumbing that fixes it
all up to whatever AWS wants.
Well that's what the AWS language bindings do ... without them it's a real
pain to use. (and it's a HUGE library).



Google Visualization:   These expect a proprietary version of "JSON-Like"
data for the API.  Truly, it's not really JSON but its kind of close.
(things like Date constructors were added which are not part of JSON).
I'm currently using a XML Database which I am using Google Visualization
API's to graph data.
I had to write a layer to translate from XML to this Google-JSON-like
format, which was not particularly hard, but would have been unnecessary if
there was an automated tool to do it, or if Google API's accepted XML.


----------------------------------------
David A. Lee
dlee at calldei.com
http://www.xmlsh.org






More information about the talk mailing list