JSON | JavaScript Object Notation :-
XML Program :-
- JSON (Javascript Object Notation) is a programming language .
- It is minimal, textual, and a subset of JavaScript.
- It is an alternative to XML
- .Android provides support to parse the JSON object and array.
- It is a lightweight data-interchange format.
- It is easy for humans to read and write.
- It is easy for machines to parse and generate.
- It is based on a subset of the JavaScript Programming Language.
XML Program :-
<Employee> <emp> <id>123</id> <name>Rama</name> <phone>98765</phone> </emp> <emp> <id>321</id> <name>supriya</name> <phone>98763</phone> </emp> <emp> <id>675</id> <name>ankit</name> <phone>6543</phone> </emp> </Employee>
JSON Program of above XML program :-
{"Employee":
[
{"id": "123",
"name":"Rama",
"phone":"98765"},
{"id":"321",
"name":"supriya",
"phone":"98763"},
{"id":"675",
"name":"ankit",
"phone":"6543"}
]
}
Note:-
Array([)
In a JSON file , square bracket ([) represents a JSON array
Objects({)
In a JSON file, curly bracket ({) represents a JSON object
Key
A JSON object contains a key that is just a string. Pairs of key/value make up a JSON object.
Value
Each key has a value that could be string , integer or double e.t.c
No comments:
Post a Comment