Can i convert array to nested json file

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”]

This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.

| Privacy Policy | Terms of Service | Remote Ruby Jobs