[Ocs] JSON spec

Laszlo Papp lpapp at kde.org
Thu Feb 9 11:35:26 PST 2012


> This format specification should be less flaky i believe.
> http://www.xml.com/pub/a/2006/05/31/converting-between-xml-and-json.html

I personally prefer this way:

XML:
	<e name="value">text</e>

JSON:
       "e": [ {"@name": "value"} , "text"] instead of "e": { "@name":
"value", "#text": "text" }

So for instance:

"e":{
  "a":[
    [{"href": "site.com"}, "main site"],
    [{"href": "/faq"}, "faq"],
    [{"href": "site.com", "target": "_blank"}, "popup to our site"]
  ]
}

=>

<e>
  <a href="site.com">main site</a>
  <a href="/faq">faq</a>
  <a href="site.com" target="_blank">popup to our site</a>
</e>

Others, opinion ?

Best Regards,
Laszlo Papp

PS.: It is not a problem for the situation without attributes, but I
think it is better to prepare in advance. :)


More information about the Ocs mailing list