JSON Tutorials
- What is Json
- Json Example
- Json Object Example
- Json with php
- How to Convert Data from MySQL to JSON using PHP
- How to store json Data into MySQL database using PHP
- How to insert json data into mysql database using PHP
- validate json string in php
- Json with AJAX
- Json with javascript
- Json Program example
Important Links
JSON object example
JSON object holds key/value pair. Each key is represented as a string in JSON and value can be of any type. The keys and values are separated by colon. Each key/value pair is separated by comma.
The curly brace { represents JSON object.
The string value must be enclosed within double quote.
{
"employee": {
"name": "mahtab",
"salary": 20000,
"married": true
}
}
In the above example, employee is an object in which "name", "salary" and "married" are the key. In this example, there are string, number and boolean value for the keys.
JSON Nested Object Example
A JSON object can have another object also. Let's see a simple example of JSON object having another object.
File name : index.php
{
"firstName": "mahtab",
"lastName": "habib",
"age": 32,
"address" : {
"streetAddress": "laxminagar",
"city": "delhi",
"state": "delhi",
"postalCode": "110092"
}
}
JSON Comments
JSON doesn't support comments. It is not a standard.