[ create a new paste ] login | about

Link: http://codepad.org/g5Ogru5Z    [ raw code | output | fork ]

PHP, pasted on Feb 4:
<?php

$json = '{
    "Product": [
        {
            "Product_Title": "Cloth",
            "Product_Description": "Here is cloth",
            "Price": "100",
            "Category_ID": "1"
        },
        {
            "Product_Title": "Cloth",
            "Product_Description": "Here is cloth",
            "Price": "100",
            "Category_ID": "1"
        },
        {
            "Product_Title": "Cloth",
            "Product_Description": "Here is cloth",
            "Price": "100",
            "Category_ID": "1"
        }
    ]
}
';

$json_decoded = json_decode($json);

echo $json_decoded->{'Product'}[0]->{'Product_Title'} . "\n\n";

print_r($json_decoded);

?>


Output:
Cloth

stdClass Object
(
    [Product] => Array
        (
            [0] => stdClass Object
                (
                    [Product_Title] => Cloth
                    [Product_Description] => Here is cloth
                    [Price] => 100
                    [Category_ID] => 1
                )

            [1] => stdClass Object
                (
                    [Product_Title] => Cloth
                    [Product_Description] => Here is cloth
                    [Price] => 100
                    [Category_ID] => 1
                )

            [2] => stdClass Object
                (
                    [Product_Title] => Cloth
                    [Product_Description] => Here is cloth
                    [Price] => 100
                    [Category_ID] => 1
                )

        )

)


Create a new paste based on this one


Comments: