JSON - JavaScript Object Notation

by saravana 2013-07-30 15:39:54

Define

JSON is lightweight text-data interchange format and language independent. JSON uses JavaScript syntax for describing data objects, but JSON is still language and platform independent. JSON parsers and JSON libraries exists for many different programming languages.

JsonSerializable - The JsonSerializable interface

JsonSerializable::jsonSerialize : Specify data which should be serialized to JSON

JSON Functions

json_decode - Decodes a JSON string
json_encode - Returns the JSON representation of a value
json_last_error_msg - Returns the error string of the last json_encode() or json_decode() call
json_last_error - Returns the last error occurred.

In JSON, they take on these forms:

An object is an unordered set of name/value pairs. An object begins with { (left brace) and ends with } (right brace). Each name is followed by : (colon) and the name/value pairs are separated by , (comma).

object.gif

JSON Example


{
"students":
[
{ "name":"Ram" , "dept":"IT" },
{ "name":"Anna" , "dept":"ECE" },
{ "name":"Siva", "dept":"Mech" }
]
}

The students object is an array of 3 student records (objects).
1217
like
0
dislike
0
mail
flag

You must LOGIN to add comments