For example, I have a JSON file called Stores.json that has lots of numbers like 1142,1234,1890, etc and each one has an address associated with it. It looks something like this but there are thousands of objects:
{
"1142": {
"Name": "P. Sherman",
"Address": "42 Wallaby Way, Sydney",
}
}
I have already looked at this answer: https://stackoverflow.com/a/24378510 But I am still confused about how to read a file based on a string, such as "1142", because I don't know what line the number is on if there are many lines.
I tried:
var mydata = JSON.parse(data**[this is Stores.json]**);
addr = mydata["1142"];
Maybe I am just confusing JavaScript with PHP? PHP code would work but I would like the JavaScript version.
EDIT: Assume that there are many objects in the file, I need to be able to select an object using a number. Basically none of the JSON is written in the Javascript Code.