I have a a JSON file with all my data in it and I want to read it to an array in my script.. below you can see an attempt, but it doesn't seem that "props" is actually getting data.. since I am new to javascript I am guessing there is something simple missing, hoping someone can tell me what I am doing wrong when loading the array.
if I call alert(record) inside the loop it outputs "0", "1", "2" incrementing during each loop, if I try to alert(record.Address1) it returns "undefined", how does this work?
var props = [];
$.getJSON('http://someurl/auction.json', function(json) {
for (var record in json)
{
props.push(
record.Address1,
record.City,
record.State,
record.Zip,
record.Bed,
record.Bath,
record.Price,
record.LotSize,
record.SQFT,
record.YearBuilt,
"10%",
record.latitude,
record.longitude,
record.Description
);
}
});
Here are the first couple records in the JSON file
[
{
"TrusteeNumber":"WA-14-611878-TC",
"Date":"8/8/2014 8:00",
"Address1":"7616 East Nora Avenue",
"Address2":"",
"County":"Spokane",
"State":"WA",
"Zip":99212,
"Description":"Description for 7616 East Nora Avenue, Spokane Valley, Spokane, WA 99212\n\n\n\n\n \n Important Documents \n\n\nTrustee Sale Terms and Conditions \n\nSample Trustee Deed Upon Sale \n\nSample Certificate of Sale/Receipt \n\nIRS Form 8300",
"City":"Spokane Valley",
"AssetType":"Residential",
"PropertyType":"SFR",
"Beds":3,
"Baths":1,
"YearBuilt":1950,
"SQFT":"1,160",
"LotSize":0.25,
"APN":"45073 0265",
"EventItemNumber":"E2010-320",
"PropertyID":1706957,
"Image":"http://cdn.mlhdocs.com/rcp_files/auctions/E-2010/photos/thumbnails/155290117-1_bigThumb.jpg",
"latitude":47.672913,
"longitude":-117.301561
},
{
"TrusteeNumber":"WA-14-611501-TC",
"Date":"8/8/2014 8:00",
"Address1":"235 W Columbia Ave",
"Address2":"",
"County":"Spokane",
"State":"WA",
"Zip":99205,
"Description":"Description for 235 W Columbia Ave, Spokane, Spokane, WA 99205\n\n\n\n\n \n Important Documents \n\n\nTrustee Sale Terms and Conditions \n\nSample Trustee Deed Upon Sale \n\nSample Certificate of Sale/Receipt \n\nIRS Form 8300",
"City":"Spokane",
"AssetType":"Residential",
"PropertyType":"SFR",
"Beds":3,
"Baths":3,
"YearBuilt":1947,
"SQFT":"3,151",
"LotSize":0.15,
"APN":"36311 3601",
"EventItemNumber":"E2010-307",
"PropertyID":1707641,
"Image":"http://cdn.mlhdocs.com/rcp_files/auctions/E-2010/photos/thumbnails/208185496-1_bigThumb.jpg",
"latitude":47.7107249,
"longitude":-117.415536
}]