Can i convert array to nested json file

#1

ex:
i have one array with elements(arr[]) so this array i have to conevrt in below formate json file formate.

{
“name”: “John”,
“age”: “twenty”,
“cars”: [{
“name”: “sunil”,
“models”: [“Fiesta”, “Focus”, “Mustang”]
}, {
“name”: “BMW”,
“models”: [“X1”, “X3”, “X5”]
}, {
“name”: “Fiat”,
“models”: [“Xuva”, “Panda”]
}
]
}