Help with JSON Data

I’m stuck on how to work with JSON in this specific instance. I have a JSON file that contains data for locations and a numerical value associated with that location. The file looks something like this:

[{"lat":63,"lng":-126,"number":58},{"lat":63,"lng":-125,"number":58},{"lat":63,"lng":-124,"number":58}...]

Using this block:


I do, in fact, get the number 58 returned back. It works as expected. However, my JSON file could contain hundreds of points to reference. How do I load all of these into a list so that I can process them? Essentially, I am working on plotting stuff on a map, but I need to get all of my coordinates loaded into a list and I am lost on how to make that happen. I want to create a list that contains the lat, lng, and number for each point loaded from my JSON. I just don’t know where to begin.

@ronnie try something like that and create 3 lists for lat, lng, and number

2 Likes

I saw that in my searches. I’m not sure that’s what I need to do, but I’ll try it and see what happens!

Looks good! I think you could also do get property of object j (where j is a variable).

Essentially, what I am trying to do is get all of the coordinates from my JSON loaded into the app. I need to store them so that I can iterate through them to draw boxes on the map. Like this:

Those boxes are what I have manually input into the map’s addPolygon element. I think the list option may be the way to go. I can build my lists of lat, lng, and number to use in building a list of objects to create the polygons. I’m not sure if @ioannis or your way would be a more efficient process, @tatiang, but I am making some progress with the lists!

I think I am going to abandon this idea. Just getting the JSON parsed is running like molasses. The JSON file has 12398 items and the app takes forever to process them all. I have a web file that already plots them on a map. I wanted to try getting rid of any web pages I could because I have a feeling the web viewer is causing some issues with errors in the app. I can’t confirm that, but I was trying to rule that out.

Thanks for the help guys! It may be valuable knowledge to me in the future!