• logo
  • PHP
  • PHP OOPs
  • script
    • JavaScript
    • JQuery
    • Ajax
    • AngularJs
    • VueJs
    • NodeJs
    • ReactJs
  • wordpress
  • Codeigniter
  • Codeigniter 4
  • Laravel
  • Python
  • MySql
  • Json
  • C
  • C++
  • More ...
    • Cakephp Framework
    • MongoDb
    • MySqli PDO
    • .htaccess
    • HTML 5
    • CSS
    • SEO
    • DCA

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

Read More

Home » JSON »  About Json

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.






Itechtuto

Connect Us Socially:

Quick Links

  • itech
  • About Us
  • Feedback
  • Trademarks
  • Privacy Policy
  • Terms of Use
  • Sitemap
  • Trademarks
  • Privacy Policy
  • Terms of Use
  • Sitemap

Copyright © 2016 itechxpert (P) Ltd. All rights reserved.

Copyright © 2016 itechxpert (P) Ltd. All rights reserved.