Currently, I am receiving a JSON file from another app and my goal is to parse it in order to extract the data contained within. The JSON includes user-defined dynamic data with changing key/value pairs, which has left me feeling uncertain about how to effectively process these variables for further use.
Below is an example of the JSON structure that I need to work with:
{
"context": [
{
"one": "https://example.one.com"
},
{
"two": "https://example.two.com"
},
{
"three": "https://example.three.com"
}
],
"name": "Batman",
"age": "30",
"one:myField": {
"two:myField2": "Hello"
},
"three:myField3": "Hello2"
}
While I can easily access static or well-defined data like name & age
, my challenge lies in understanding how to retrieve user-defined/dynamic data from this JSON format where key/value pairs are not consistent and may not follow a specific order after the 'age' property.
I am currently exploring ways to extract all user-defined data from this JSON:
"one:myField": {
"two:myField2": "Hello"
},
"three:myField3": "Hello2"
Is there a straightforward method or library that can help achieve this task? I am building my application using Vuejs/Nuxtjs framework.