Loading ...
Sorry, an error occurred while loading the content.

1373Re: [json] JSON representation for XML snippet

Expand Messages
  • Tatu Saloranta
    Sep 14, 2009
      On Mon, Sep 14, 2009 at 9:17 AM, Shalab Goel <goel.shalab@...> wrote:
      > Hello,
      > Is there a standard way to represent the information in following XML snippet
      > as JSON output.
      > <attributes>
      >  <attribute a1="v1">value1</attribute>
      >  <attribute a2="v2">value2</attribute>
      > </attributes>
      > Is there an online tool that would generate this conversion?

      It depends on what you'd expect to get out of it, but I think the
      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 +-
    • Show all 3 messages in this topic