Reputation: 4302
I am relatively new to web development and web applications. I have heard about JSON but am not sure exactly what its uses are.
Upvotes: 1
Views: 6603
Reputation: 3044
First, it's an acronym for JavaScript Object Notation.
It is often used in places where applications deal with object data structures (often seen in languages such as Java, C#, etc.), and associative arrays (key-value pairs seen in many languages such as Python, PHP, etc.)
To answer your question, it's a simple and efficient way to encode objects into strings, transfer them, and recreate the objects on the other end.
Example of JSON encoding in PHP
Upvotes: 1
Reputation:
JSON is a format for encoding information returned by the server. When you call a script with AJAX/XHR (e.g. with JavaScript) the returned information can come via XML, JSON, or another format. JSON is simply a way to return that data in an object structure native to JavaScript - in a way that generally doesn't require a lot of parsing, like XML does.
Upvotes: 9
Reputation: 56467
It is a kind of language for encoding information. For example, if you want to send information about person from one place to another, then it JSON it may look like this:
{
"firstName": "John",
"lastName": "Smith",
"age": 25,
"address":
{
"streetAddress": "21 2nd Street",
"city": "New York",
"state": "NY",
"postalCode": "10021"
},
"phoneNumber":
[
{
"type": "home",
"number": "212 555-1234"
},
{
"type": "fax",
"number": "646 555-4567"
}
]
}
Taken from wiki. :) See http://en.wikipedia.org/wiki/JSON for more details.
Upvotes: 4