Can anyone explain me what is JSON and why to use JSON and is it better than XML or it depends upon the work being done?
For further actions, you may consider blocking this person and/or reporting abuse
Can anyone explain me what is JSON and why to use JSON and is it better than XML or it depends upon the work being done?
For further actions, you may consider blocking this person and/or reporting abuse
Ben Santora -
saman sardari -
saman sardari -
Megha Sharma -
Top comments (1)
JSON is a data serialization format derived from JavaScript's object literal syntax (which happens to look like the object/dictionary/map syntax from many other programming languages).
The original idea was that because it's also valid JS code (except it might not be, there are differences in the official spec), you could just use the
exec()
function to load it in JS. This is no longer the recommended way to use it (for multiple reasons), but JSON has a number of other benefits:Note, there are other options than JSON if you want to serialize data. YAML is rather popular too (it goes even further than JSON in terms of readability, but loses some of the simplicity of parsing in exchange for this), and many languages have some 'native' data serialization format (Python has it's pickle module, Erlang and Elixir have ETF, etc). JSON is good for interoperability when you need to talk between two software components, but there are better options in some cases.