EDIT: Going off teemu's comment below, this is similar to his recommended post, but none of my objects have arrays inside of them, so that post did not solve my problem.
EDIT: I cannot just do
data2.forEach(function(provider) {provider['parameters']['name']});
because there is only one object with the key of 'name'. The function needs to be iterative and able to extract all the information from every object at once
EDIT: I have parsed all the JSON now I am just trying to write a function/method which extracts the part that I want. The "data2" below is the variable which stores the parsed JSON
I have an API sending me unorganized JSON that I need to extract certain parts of. Below you see the "parameters" object. I need to extract everything within it. For example I need to extract "nameInfo": "name" and "lastName", "alarmSet": "time" and "temperature", "business": "businessName" and "yearsInBusiness", etc.
Goal: I am trying to make a table that says nameInfo bob smith, alarmSet 5 o'clock 72 degrees, etc. etc.
The only thing that all of the JSON has in common is the "parameters" title. Everything else inside the "parameters" object is different. And everything within the objects inside the "parameters" object is different.
Currently what I'm doing is...
data2.forEach(function(provider) {provider['parameters']});
and this just returns [object Object] [object Object] [object Object] [object Object] [object Object] [object Object] etc....
"paramaters": {
"info": {
"name": "bob",
"lastName": "smith"
}
"alarmSet": {
"time": "5 o'clock"
"temperature": "72 degrees"
}
}
"parameters": {
"business": {
"businessName": "ice cream shop",
"yearsInBusiness": "17 years"
}
"policeRecords": {
"misdemeanors": "attempted ice cream stealing",
"felonies": "convicted of melting ice cream"
}
}