1373Re: [json] JSON representation for XML snippet
- Sep 14, 2009On Mon, Sep 14, 2009 at 9:17 AM, Shalab Goel <goel.shalab@...> wrote:
> Hello,It depends on what you'd expect to get out of it, but I think the
> Is there a standard way to represent the information in following XML snippet
> as JSON output.
> <attribute a1="v1">value1</attribute>
> <attribute a2="v2">value2</attribute>
> Is there an online tool that would generate this conversion?
answer is no: there is nothing obvious and standard.
It really depends on meaning of data above.
personally I think it is better to convert from original data
(objects, relational data) into structurally distinct data formats
(xml and json have fundamentally differen data models, hierachic vs
struct/frame/object model... but I digress). And as such, if possible,
it's better to figure out meaning of data and then produce "native"
xml and json, without trying to convert from json to xml or vice
versa. Latter is more difficult, and data in one (... or both) of
formats will end up looking funny and somewhat unreadable
Anyway: instead of "the" standard, there however multiple competing
standard proposals (called "mapping conventions") that do allow
converting any XML content into well-formed (if bit odd-looking and
alien-feeling :) ) JSON.
One such convention is Badgerfish (see, for example
and there are multiple others that claim to produce natural JSON.
-+ Tatu +-
- << Previous post in topic Next post in topic >>