Link to home
Start Free TrialLog in
Avatar of gudii9
gudii9Flag for United States of America

asked on

json format text only

Hi,

I am reading about json at below url

http://www.w3schools.com/json/

I have not understood below statement
* JSON uses JavaScript syntax, but the JSON format is text only, just like XML.
what it mean by json format is text like XML.
is XML is text only. json format text means what? we cannot use numbers?
please advise
SOLUTION
Avatar of zephyr_hex (Megan)
zephyr_hex (Megan)
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
ASKER CERTIFIED SOLUTION
Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of gudii9

ASKER

whereas in JSON format these name MUST be textual :-

Javascript : { field1: "the good rat", field2: "the bad mouse" }
JSON         : { "field1": "the good rat", "field2": " The bad mouse" }

Notice the quotes around the field names.

i see.

what is the advantage of json key name text formatting like textual i,e ""

please advise
There is no advantage. It is done to simplify things, since in Javascript the "field name" can be a number or a boolean value. Also note that you must always use double quotes and not single quotes, which are allowed in javascript.

https://en.wikipedia.org/wiki/JSON