title: Get nested JSON
body: <p>How can I get the 'value' inside the 'cost'? Please help me, I just learned JSON from w3schools. I have tried, but it didn't work. My code for get the 'value' is in the bottom of the code.</p>
  
  <pre><code> &lt;p id="demo"&gt;&lt;/p&gt;
  
   &lt;script&gt;
   var text='{ "rajaongkir":{
    "query":{
       "origin":"501",
       "destination":"114",
       "weight":1700,
       "courier":"jne"
    },
    "status":{
       "code":200,
       "description":"OK"
    },
    "origin_details":{
       "city_id":"501",
       "province_id":"5",
       "province":"DI Yogyakarta",
       "type":"Kota",
       "city_name":"Yogyakarta",
       "postal_code":"55000"
    },
    "destination_details":{
       "city_id":"114",
       "province_id":"1",
       "province":"Bali",
       "type":"Kota",
       "city_name":"Denpasar",
       "postal_code":"80000"
    },
    "results":[
       {
          "code":"jne",
          "name":"Jalur Nugraha Ekakurir (JNE)",
          "costs":[
             {
                "service":"OKE",
                "description":"Ongkos Kirim Ekonomis",
                "cost":[
                   {
                      "value":38000,  //&lt;&lt;&lt;&lt;&lt;&lt;  GET THIS VALUE
                      "etd":"4-5",
                      "note":""
                   }
                ]
             },
             {
                "service":"REG",
                "description":"Layanan Reguler",
                "cost":[
                   {
                      "value":44000,
                      "etd":"2-3",
                      "note":""
                   }
                ]
             },
             {
                "service":"SPS",
                "description":"Super Speed",
                "cost":[
                   {
                      "value":349000,
                      "etd":"",
                      "note":""
                   }
                ]
             },
             {
                "service":"YES",
                "description":"Yakin Esok Sampai",
                "cost":[
                   {
                      "value":98000,
                      "etd":"1-1",
                      "note":""
                   }
                ]
             }
          ]
       }
    ]}}';  
     obj=JSON.parse(text);
     document.getElementById("demo").innerHTML=
     obj.rajaongkir.results[0].costs[0].cost[0].value;
     &lt;/script&gt;
  </code></pre>