Nested Json to Content Fragment Model
Hi Team
I have a requirement to read the nested json and add nested json values in dropdowns in Content Fragment Model.
For a normal json, I have created a servlet and calling the servlet to retrieve values to the dropdown in Content Fragment Model.
However my input is nested json and I want values in related dropdowns like based on the country selection I want states to be populated and based states selection I want cities to be populated.
Below is the example json.
{
"countries": [
{
"name": "United Kingdom",
"states": [
{
"name": "England",
"cities": ["London", "Manchester", "Birmingham"]
},
{
"name": "Scotland",
"cities": ["Glasgow", "Edinburgh", "Aberdeen"]
}
]
},
{
"name": "Australia",
"states": [
{
"name": "New South Wales",
"cities": ["Sydney", "Newcastle", "Wollongong"]
},
{
"name": "Victoria",
"cities": ["Melbourne", "Geelong", "Ballarat"]
}
]
},
{
"name": "Germany",
"states": [
{
"name": "Bavaria",
"cities": ["Munich", "Nuremberg", "Augsburg"]
},
{
"name": "North Rhine-Westphalia",
"cities": ["Cologne", "Düsseldorf", "Dortmund"]
}
]
}
]
}
Please advise.


