json parsing in php
<p>I have the following JSON String</p>

<pre><code>{
        "name":"Product",
        "properties":
        {
                "id":
                {
                        "type":"number",
                        "description":"Product identifier",
                        "required":true
                },
                "name":
                {
                        "type":"string",
                        "description":"Name of the product",
                        "required":true
                },
                "price":
                {
                        "type":"number",
                        "minimum":0,
                        "required":true
                },
                "tags":
                {
                        "type":"array",
                        "items":
                        {
                                "type":"string"
                        }
                },
                "stock":
                {
                        "type":"object",
                        "properties":
                        {
                                "warehouse":
                                {
                                        "type":"number"
                                },
                                "retail":
                                {
                                        "type":"number"
                                }
                        }
                }
        }
}    
</code></pre>

<p>I would like to access </p>

<pre><code>properties - &gt; stock - &gt; properties - &gt; warehouse.
</code></pre>

<p>In python I can do the following. </p>

<pre><code>f = open("c:/dir/jsondec.json")
data = json.load(f)
node = data['properties']['stock']['properties']['warehouse']
print str(node)
</code></pre>

<p>I'm trying to do the same thing in PHP. I know I can use <code>json_decode()</code> but what should be the correct syntax. 
Also If I have an array within say within <code>properties-&gt; ID</code> I could have done <code>['properties'][0]['id']</code> to access that. What would be the equivalent in php?</p>
