Seeking to retrieve data from a local JSON file that contains nodeIDs with longitude, latitude, and adjacent nodeIDs as values.
For example:
[{"33583379": {"lat": 40.7046387, "lon": -74.0167729, "adj": ["33583379", "1659428533"]}, "33583380": {"lat": 40.7043271, "lon": -74.0169624, "adj": ["33583379", "33583381"]}, etc.}]
The goal is to extract the Object name
, "lat"
, and "long"
values of each object and store them in arrays like this:
[33583379, -73.984293,40.729468],
[33583380, -73.987752,40.732017]
Attempted to use Object.keys(data[0])
but it retrieves all object names, and finding a way to fetch them one by one in the same loop has been a challenge.
Any assistance is welcome. Have been struggling for hours to extract the necessary key values from the JSON file and format them into an array. PS: Working on a project in React.