Hi,
my application has some text fields inside a MySQL database containing JSON objects. I want the REST-API to return them inline in the JSON response as native JSON. As the default, the API returns them as escaped strings, so that the API consumer has to JSON decode them on their own.
Example given, this is what comes out of the API now:
{
"contact_data": "[{\n \"type\": \"phone\",\n \"name\": \"Telefon\",\n \"value\": \"+49 321 123456\"\n},{\n \"type\": \"email\",\n \"name\": \"E-Mail\",\n \"value\": \"user@domain.de\"\n}]"
}
This is what I want:
{
"contact_data": [
{
"type": "phone",
"name": "Telefon",
"value": "+49 321 123456"
},{
"type": "email",
"name": "E-Mail",
"value": "user@domain.de"
}
]
}
Any ideas how to get this done? And what about writing those fields?
Greets,
spackmat