Hello readers, today we discuss about "Handling data in a PHP JSON Object".
There are many tutorials available for handling JSON using PHP, but problem with most of them is they don't help more than organizing an assortment towards json_encode and expecting for the best. This information aims at launching straight into JSON and allow proper handling in combination with PHP. Visitors dont always need to use PHP as the encoding dialect, as they can also go for the primary part of which acts to be a basic review about JSON.
JSON (JavaScript Object Notation) provides alternate data format which is light and easily readable for humans. The format can be chosen as a subset from the JavaScript dialect that was standard throughout 1999.
JSON has the potential to cope with it natively throughout JavaScript. It wont be wrong to call it as the glue between server- and client-side application judgement. Its easy to reduce syntactical cost and shift fewer bytes of wire. JSON replaces XML as the de-facto payload data format and buyer part application frameworks like spine, thanks to inside contemporary world wide web stacks.
Below is the example of "Handling data in a PHP JSON" .
<?php
$json_url = "http://search.twitter.com/trends.json";
$json = file_get_contents($jsonurl,0,null,null);
$output = json_decode($json);
foreach ( $output->trends as $trend )
{
echo "{$trend->name}\n";
}
?>
0 Comment(s)