What is json in php with example

JSON ( JavaScript Object Notation ), is an open standard format that uses human-readable text to transmit data objects. The JSON standard only supports when you are using inside an array or an object in your web applications. There are the native functions in php language to encode and decode your JSON data.

You can encode your data in JSON format using the ” json_encode() ” function and decode your data using json_decode() function.

json_logo-555px

Example (A) json_encode() example

The above example will output:

Example (B) json_decode() examples

The above example will output:

Data types, syntax and example

The following example shows the JSON representation. The object has string fields for first name and last name, age, an object representing the person’s address and phone number objects.

If you like FreeWebMentor and you would like to contribute, you can write an article and mail your article to [email protected] Your article will appear on the FreeWebMentor main page and help other developers.

Recommended Posts:


Prem Tiwari

An engineer by profession and a passionate blogger by heart. Founder of FreeWebMentor.com (A Programming blog for beginners), Tech Speaker at various forums. A part from this he is an open source enthusiast, WordPress Lover, Blogger, SEO, and Growth Strategic.

Article Tags: , , , , , , , , , , , , ,