Skip to end of metadata
Go to start of metadata

PHP provides strong solutions for JSON. json_encode($src_obj) converts obj to JSON text. json_decode($src_text) converts text string to JSON object.


<?php

$arr = array('a' => 1, 'b' => 2, 'c' => 3, 'd' => 4, 'e' => 5);

echo json_encode($arr);

?>


<?php

$json = '{"a":1,"b":2,"c":3,"d":4,"e":5}';

var_dump(json_decode($json));
var_dump(json_decode($json, true));

?>