I was working on how to extract data from JSON data
I wrote the below code to extract the variable named code that is equal to ur
But not getting the results.
<script>
var txt = '{ "type":"ipv4", "location":{ "geoname_id":2816, "languages":[ { "code":"en", "name":"English" }, { "code":"ur", "name":"Urdu" } ], "is_eu":false } }';
var obj = JSON.parse(txt);
console.log(obj.location.languages.code);
</script>