What is json in php with example

| Last Updated: | In: Core php


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.

Tags: , , , , , , , , , , , , ,


About: Prem Tiwari

Prem Tiwari is founder of freewebmentor.com and Software developer from New Delhi (India). Follow Prem's development codes on facebook, and make sure you check out freewebmentor.com for the latest in web development related Tips with the complete code.


You may also like:

Follow us!

Get Free Access of 350+ Scripts

Don't worry you'll not be spammed!

Featured eBook

WordPress Security Guide

Learn how to implement security guideline in your WordPress site...

DOWNLOAD

Pincode Finder

pincode-finder tool

Online Pincode Finder

Best tool to locate post Office address and pincodes of all india...

SEARCH NOW