[Home] [By Thread] [By Date] [Recent Entries]

  • From: Robert Koberg <rob@k...>
  • To: Michael Kay <mike@s...>
  • Date: Tue, 12 Feb 2008 07:31:57 -0500

On Tue, 2008-02-12 at 10:03 +0000, Michael Kay wrote:
> > Well, it isn't really the same. You can't go up or side ways. 
> > Also, after a quick search it was the only project of its kind.
> > 
> > I created something that aids XPath. But I cheat and parse 
> > the JSON and add parents and siblings to each object. 
> 
> Is there an accepted mapping of JSON to XML? And is there a SAX parser?

Kind of, if you go by Douglas Crockford's example (he 'invented' json).
But there is nothing standardized.
http://www.json.org/java/index.html

When I have had to work with JSON in java, I have prefered the following
which is based on on Crockford's work:
http://json-lib.sourceforge.net/

Also, at the bottom of the json.org page I saw links for:

  * JSONPath.
  * Jaql: A JSON Query Language.
  * XSLTJSON.
xml2json-xslt.

Oh, and there is always something like:

var parse = function(something) {
  if (something instanceof Array) {
     for (var i=0; i < something.length; i++) {
       parse(something[i]);
    }
  } elseif (something instanceof Object) {
    for (var prop in something) {
      parse(something[prop]);
    }
  } else {
    return something;
  }
};

best,
-Rob



[Date Prev] | [Thread Prev] | [Thread Next] | [Date Next] -- [Date Index] | [Thread Index]


Site Map | Privacy Policy | Terms of Use | Trademarks
Free Stylus Studio XML Training:
W3C Member