Can someone tell me practical reasons why i should use JSON? | Sololearn: Learn to code for FREE!


Can someone tell me practical reasons why i should use JSON?

7/4/2017 7:38:17 PM

kukogho gabriel

8 Answers

New Answer


JSON along with XML are the most popular and frequently used standards of formatting datasets, translatable to any modern programming language. Both are easily comprehensible, platform- and OS-independent and capable.


It's often used when data to sent from a server to a web page. JSON syntax is derived from JavaScript  is a format for storing and transporting data.


If you develop a web services chances are that you prefer to use json to encode the output. Today is practically a standard. If you use a nosql database, like mongodb, you can use json by the same reason


JSON is easy to learn because the main part is: "attribute":"value" and its very usefull


Due to the syntax XML is much larger then JSON. This is why JSON is the preference in web data transfer. Programming languages can recognise JSON data types easily.


Database can be store in Json format. Rest Api transport data also in Json format too. Javscript objects are closely similar to JSON format. Example of a dataset in JSON data: { "students": [ { "id": "1", "name": "Hiro Otawa", "age": "27" }, { "id": "2", "name": "Y.T"', "age": "16" } ] } Which can be converted into Javascript object using data = JSON.parse(json) data = { students: [ { id: 1, name: 'Hiro Otawa', age: 27 }, { id: 2, name: 'Y.T.', age: 16 } ] } In turn, Javascript can convert its objects to dataset in JSON for database or data transportation using json = JSON.stringify(data); function


If we want to serialize a table into JSON and XML, assuming equal number of records, which format in your opinion would be larger (in bytes) between the two?. And which of them supports field definition & description (data type, length etc.)?.


I use json for a config file for my open source discord bot