I am a bit stuck parsing a JSON array when it is the only thing returned in a JSON response.
I know how to parse an array when it is a sub record of a json response but not as the only response.
For example, i know how to do data.streams.array[0].item for example but when there is no 'streams' part of that i am not sure what to do (basically it goes straight to array[0]
Sample code of what i have tried below
$( document ).ready(function() {
console.log( "ready to explore" );
$("#getMessage").click(function(){
$("ul").empty();
$.getJSON("https://api.planningalerts.org.au/applications.js?key=<<KEY>>&postcode=2000", function(json){
var test2 = JSON.stringify(json);
alert(test2);
var test = json.address;
alert(test);
Sample json resposne i am trying to parse (remembering it goes straight to array)
[{
"application": {
"id": 609706,
"council_reference": "1-3879101556",
"address": "\"Harbour Plaza\" Lot 5, 25-29 Dixon Street, Haymarket 2000",
"description": "Triple 8 Hotel - Liquor licence transfer",
"info_url": "http://www.ilga.nsw.gov.au/liquor/application-noticeboard",
"comment_url": "mailto:liquorapplications@olgr.nsw.gov.au?subject=Application%20Number:%201-3879101556",
"lat": -33.877797,
"lng": 151.203659,
"date_scraped": "2016-01-06T01:01:59.000Z",
"date_received": "2016-01-05",
"on_notice_from": null,
"on_notice_to": "2016-02-04",
"no_alerted": 178,
"authority": {
"full_name": "NSW Independent Liquor and Gaming Authority"
}
}
}, {
"application": {
"id": 609709,
"council_reference": "1-3879170112",
"address": "World Square L 10 680 George St, Sydney 2000",
"description": "Sydney Chinese New Year 2016 - Chinese Film Festival 15/02/2016 - Limited licence - special event",
"info_url": "http://www.ilga.nsw.gov.au/liquor/application-noticeboard",
"comment_url": "mailto:liquorapplications@olgr.nsw.gov.au?subject=Application%20Number:%201-3879170112",
"lat": -33.8772162,
"lng": 151.2068193,
"date_scraped": "2016-01-06T01:01:59.000Z",
"date_received": "2016-01-05",
"on_notice_from": null,
"on_notice_to": "2016-01-19",
"no_alerted": 182,
"authority": {
"full_name": "NSW Independent Liquor and Gaming Authority"
}
}
}]
Any help really appreciated :)
Cheers