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

1512Re: SV: [json] JSON representation for XML snippet

Expand Messages
  • Fredag_d13
    Apr 7, 2010
      That looks pretty perfect to me. I think I will include JSONML support in the next release of my JSON api.

      Thanks to Mark Joseph for starting this discussion and thank you Stephen for the JSONML pointer.

      I like the idea that no special characters such as @, # or stringpatterns are needed.

      /Jonas

      --- In json@yahoogroups.com, "stephen.mckamey" <stephen@...> wrote:
      >
      > Exactly. We were posting very similar examples at the same time. :)
      >
      > --- In json@yahoogroups.com, "Mark Joseph" <mark@> wrote:
      > >
      > > Ok I think I see how mixed content works in JsonML:
      > >
      > > <description lang="en-us"> hi there <bold>joe</bold> how are you </descrption>
      > >
      > > becomes
      > >
      > > [ "description", {"lang":"en-us"},
      > > " hi there ",
      > > [ "bold", "joe" ],
      > > " how are you "
      > > ]
      > >
      > > Is that right?
      > >
      > >
      > > Best,
      > >
      > > Mark Joseph, Ph.D.
      > > President
      > > P6R, Inc
      > > 408-205-0361
      > > mark@
      > > Skype: markjoseph_sc
      > > _____
      > >
      > > From: stephen.mckamey [mailto:stephen@]
      > > To: json@yahoogroups.com
      > > Sent: Tue, 06 Apr 2010 10:20:12 -0700
      > > Subject: Re: SV: [json] JSON representation for XML snippet
      > >
      > >
      > >
      > >
      > >
      > >
      > > Not that ugly:
      > >
      > > ["node1", {"a":"45"},
      > > ["node2", {"b":"9", "c":"hithere"},
      > > ["node3", {"d":"abc"},
      > > ["node4", {"e":"12345"}, "JSON has no attributes"]
      > > ]
      > > ],
      > > "Now is the time for all good men to come to the aid of their party",
      > >
      > > ["node5", {"d":"45"}, "temperature is 70 degrees today"]
      > > ]
      > >
      > > --- In json@yahoogroups.com, "Mark Joseph" <mark@> wrote:
      > > >
      > > >
      > > > Handling XML attributes when converting to JSON:
      > > > **************************************
      > > > <attribute a2="v2">value2</attribute>
      > > > will be
      > > > {"attribute":{"a2":"v2"},"#text":"value2"}
      > > >
      > > > as example ... while JSONML uses this kind of schema
      > > >
      > > > ["nodeName",{"a2":"v2"},"text or nested nodes"]
      > > >
      > > > so that this:
      > > >
      > > > <attributes>
      > > > <attribute a2="v2">value2</attribute>
      > > > </attributes>
      > > >
      > > > will be this
      > > >
      > > > ["attributes",{},["attribute",{"a2":"v2"},"value2"]]
      > > > ****************************************
      > > >
      > > > So all of the above works well when you have simple XML.
      > > > But with something like:
      > > >
      > > > <node1 a="45">
      > > > <node2 b="9" c="hithere">
      > > > <node3 d="abc">
      > > > <node4 e="12345">JSON has no attributes</node4>
      > > > </node3>
      > > > </node2>
      > > > Now is the time for all good men to come to the aid of their party
      > > >
      > > > <node5 d="45">temperature is 70 degrees today</node5>
      > > > </node1>
      > > >
      > > > The resulting JSON is going to be "ugly". Many added arrays
      > > > are added to handle the attributes and nested nodes now appear in the
      > > > added arrays. To me this adds a lot of extra complexity that I am
      > > > not sure I want.
      > > >
      > > >
      > > >
      > > > Best,
      > > > Mark Joseph, Ph.D.
      > > > P6R, Inc
      > > >
      > >
      > >
      > >
      > >
      > > [Non-text portions of this message have been removed]
      > >
      >
    • Show all 28 messages in this topic