Search

Parse JSON PHP

> Decode JSON string

Description
Parse JSON string


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

json_decode( $json );

// Result:
object(stdClass)#1 (5) {
    ["a"] => int(1)
    ["b"] => int(2)
    ["c"] => int(3)
    ["d"] => int(4)
    ["e"] => int(5)
}
Returns an Object

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

json_decode( $json, true );

// Result:
array(5) {
    ["a"] => int(1)
    ["b"] => int(2)
    ["c"] => int(3)
    ["d"] => int(4)
    ["e"] => int(5)
}
Returns an Array

SEE ALSO