Over a million developers have joined DZone.

Creating and Parsing JSON Data in PHP

·

This code demonstrates how to create and parse the JSON data format of using array of PHP. It's a very simple code, that allows you to perform this task.

1,'name'=>'jackson','country'=>'usa','office'=>array('google','oracle')
);
echo json_encode
($json_data);

// Result:
// {"id":1,"name":"jackson","country":"usa","office":["google","oracle"]}
?>
Topics:

Opinions expressed by DZone contributors are their own.

The best of DZone straight to your inbox.

SEE AN EXAMPLE
Please provide a valid email address.

Thanks for subscribing!

Awesome! Check your inbox to verify your email so you can start receiving the latest in tech news and resources.
Subscribe

{{ parent.title || parent.header.title}}

{{ parent.tldr }}

{{ parent.urlSource.name }}