Skip to content

Instantly share code, notes, and snippets.

@mauritslamers
Created August 28, 2008 16:48
Show Gist options
  • Save mauritslamers/7770 to your computer and use it in GitHub Desktop.
Save mauritslamers/7770 to your computer and use it in GitHub Desktop.
$records = array();
$ids = array();
$products = array();
$product_one = new stdClass;
$product_one->id=1;
$product_one->name="cheese";
$product_one->price=1;
$product_two = new stdClass;
$product_two->id=2;
$product_two->name="ham";
$product_two->price=2;
$records[] = $product_one;
$records[] = $product_two;
$jsonobject = new stdClass;
$jsonobject->records = $records;
$jsonobject->ids = $ids;
// $jsonobject->hello = 'world';
// object assembled, so send
echo json_encode($jsonobject);
// echo "hello world";
?>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment