IT:AD:JSON:HowTo:Flatten JSON
Summary
You generally only need to flatten JSON when developing POCs – the rest of the time, JSON is coming out of a service, already stripped of unnecessary spacing and indenting.
Process
There are several sites online that can do the trick:
The above tool takes:
{
"title": "My Form",
"sections": [
{
"type": "none|labelled|tab",
"name": "grp1",
"fields": [
{
"key": "FirstName",
"field_type": "text",
"label": "First Name:",
"binding": "firstName",
"validations": [
{
"type": "required"
},
{
"type": "minLength",
"min": "1"
}
]
},
{
"key": "Gender",
"field_type": "options",
"label": "Gender:",
"binding": "gender",
"options": "genderOptions",
"validations": [
{
"type": "required"
}
]
}
]
}
]
}
and produces:
{"title":"My Form","sections":[{"type":"none|labelled|tab","name":"grp1","fields":[{"key":"FirstName","field_type":"text","label":"First Name:","binding":"firstName","validations":[{"type":"required"},{"type":"minLength","min":"1"}]},{"key":"Gender","field_type":"options","label":"Gender:","binding":"gender","options":"genderOptions","validations":[{"type":"required"}]}]}]}