On Fri, May 14, 2010 at 12:40 PM, Nils Breunese <[email protected]> wrote:
> Cory Zue wrote:
>
> Actually I'm not really surprised, since XML is a more complex data
> format than JSON, so there is no true 1-to-1 mapping. Consider XML
> attributes and elements for instance. Initially you might think mapping
> them to JSON name/value pairs is a good idea, but attributes and
> elements can have the same name:
>
> <person problem="yes">
> <problem>This is a problem.</problem>
> <name>Nils</name>
> </person>
>
> How would you represent this in JSON? You might prefix attributes with
> underscores or something, but it starts getting clunky fast.
I was thinking of the xsd way of dealing with this by prefixing
attributes with "@", which in your case would look like:
{
"@problem": "yes"
"type": "person",
"problem": "This is a problem.",
"name": "Nils"
}
However, I guess I'm just surprised no one's decided to standardize
(and implement) this conversion yet.
Cory