public
Created

  • Download Gist
json-vs-xml.js
JavaScript
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36
/**
* Original representation
*/
<?xml-stylesheet type="text/xsl" href="xml2json.xslt"?>
<reports xmlns="http://www.w3.org/2005/Atom"
xmlns:georss="http://www.georss.org/georss">
<entry>
<title>A large tree branch is blocking the road</title>
</entry>
</reports>
 
/**
* Contains all of the above information but is bloated
*/
{
"reports": {
"@xmlns": {
"$": "http://www.w3.org/2005/Atom",
"georss": "http://www.georss.org/georss"
},
"entry": [{
"title": {
"$": "A large tree branch is blocking the road"
}
}]
}
}
 
/**
* Minimalist and developer centric; doesn't contain foreign information such as XML namespace info
*/
{
"reports": [{
"title": "A large tree branch is blocking the road"
}]
}

Please sign in to comment on this gist.

Something went wrong with that request. Please try again.