JSON reponse in complex structures

When I ask a JSON response it works only if have key and value
but crash when is more complex

{key: value,
key: value}

goes well

but:
{key {
key:value,
key:value
},
key{
key:value,
key:value
},
}
allways stole me the last } so my api cant work well

also i have to remove ```json in the answer

is there something to help me to have a clean json allways ?

1 Like

Hi Nicogargas,
I haven’t tried exactly what you’re describing but I’ve done close to it. My advice is to spell out in your instructions the structure of the of the json you want. You will still likely get the ```json at the beginning and ``` at the end and I used regex to get rid of those things before I then had useable json. For yours you might spell out I’m going to have an object ‘car’ that will have a make, model, then interior which will be object of color and materials. This might get you closer to intended goal.
{car{
tires: 4,
seats: 5
},
interior{
color: black,
material: leather
},
}