Hi how i can parse this json string: {"Error":true, "data":["not available","somethinghere"]}
but that string i get it from an alert like this:
alert(ff.Result.value);
i need to get from that alert just the "not available" from the json string
Hi how i can parse this json string: {"Error":true, "data":["not available","somethinghere"]}
but that string i get it from an alert like this:
alert(ff.Result.value);
i need to get from that alert just the "not available" from the json string
Most modern browsers support the JSON object:
var errorObject = JSON.parse(ff.Result.value);
alert(errorObject.data[0]);
See Browser-native JSON support (window.JSON)
An example using json2.js:
<script src="https://raw.github.com/douglascrockford/JSON-js/master/json2.js"></script>
<script>
var errorObject = JSON.parse(ff.Result.value);
document.getElementById('someId').innerHTML += errorObject.data[0];
</script>