incubator-couchdb-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Cory Zue <>
Subject Re: _update, XML, and POST
Date Fri, 14 May 2010 13:10:49 GMT
On Fri, May 14, 2010 at 12:40 PM, Nils Breunese <> 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.


View raw message