Sunday, January 24, 2010

[jQuery] XML object to JSON

Hello,

I am trying to convert an XML object that I have to JSON so I can
store it in the browsers cache for later retrieval -- using
DOMCached. When I encode the object to JSON using the google json
plugin I get an output like this:

{"length":187,"0":{"jQuery1264367243616":2315},"1":
{"jQuery1264367243616":2316},"2":{"jQuery1264367243616":2317},"3":
{"jQuery1264367243616":2318},"4":{"jQuery1264367243616":2319},.....

where the jQuery######## are supposed to be sub nodes. How can I best
encode this XML object to JSON? Or does anyone know of a better way
to browser cache an XML object?

Thanks,
Shane.

No comments: