Answer the question
In order to leave comments, you need to log in
Differences between XML and JSON?
Can you tell me the main theses in the difference between XML and JSON?
Answer the question
In order to leave comments, you need to log in
XML is a markup language.
<widget>
<debug>on</debug>
<window title="Sample Konfabulator Widget">
<name>main_window</name>
<width>500</width>
<height>500</height>
</window>
<image src="Images/Sun.png" name="sun1">
<hOffset>250</hOffset>
<vOffset>250</vOffset>
<alignment>center</alignment>
</image>
<text data="Click Here" size="36" style="bold">
<name>text1</name>
<hOffset>250</hOffset>
<vOffset>100</vOffset>
<alignment>center</alignment>
<onMouseUp>
sun1.opacity = (sun1.opacity / 100) * 90;
</onMouseUp>
</text>
</widget>
"widget": {
"debug": "on",
"window": {
"title": "Sample Konfabulator Widget",
"name": "main_window",
"width": 500,
"height": 500
},
"image": {
"src": "Images/Sun.png",
"name": "sun1",
"hOffset": 250,
"vOffset": 250,
"alignment": "center"
},
"text": {
"data": "Click Here",
"size": 36,
"style": "bold",
"name": "text1",
"hOffset": 250,
"vOffset": 100,
"alignment": "center",
"onMouseUp": "sun1.opacity = (sun1.opacity / 100) * 90;"
}
}
Working with XML through DOM, JSON through an object. Where it is less and easier to write code, obviously.
With JS ON, it is much more convenient to work with JS than with XML, and, for example, PHP too, and there are libraries for other modern languages, so JSON support is more priority, but if the API will be used by a large audience, or there will be clients using tools like Delphi 7, you also need XML support.
And there is also an option to return HTML, this is for server rendering of parts of pages, but it is convenient for the client to work with this only if it is a browser, in fact HTML is not XML, parsing it using XML tools is unacceptable, as well as, obviously, using tools for JSON, that is, without a browser (or "engine" from the browser), consider it in any way.
xml and html are related languages - this is a tree type data structure
json is a text data format originally from js
designed to exchange data between programs
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question