Skip to content

Instantly share code, notes, and snippets.

@apphp
Created January 26, 2014 11:27
Show Gist options
  • Save apphp/8631342 to your computer and use it in GitHub Desktop.
Save apphp/8631342 to your computer and use it in GitHub Desktop.
Creating and Parsing JSON Data in PHP
<?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.
// source: http://www.apphp.com/index.php?snippet=php-create-and-parse-json-data
$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"]}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment