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.
[View All Snippets]
[View All Snippets]
Show Plain Text »
- <?php
- $json_data = array(
- 'id'=>1,'name'=>'jackson','country'=>'usa','office'=>array('google','oracle')
- );
- echo json_encode($json_data);
- ?>
Result:
{"id":1,"name":"jackson","country":"usa","office":["google","oracle"]}