I have this struct:
type ResponseStatus struct {
StatusCode int
Message string
Data string `json:"data"`
}
type Pets struct {
Id int `json:"id"`
Name string `json:"name"`
Age int `json:"age"`
Type string `json:"type"`
}
and this is my json result:
{
"StatusCode": 200,
"Message": "Hello framework - OK",
"data": "[{\"id\":1,\"name\":\"george\",\"age\":2,\"type\":\"dog\"},{\"id\":2,\"name\":\"walter\",\"age\":1,\"type\":\"rabbit\"},{\"id\":3,\"name\":\"tom\",\"age\":1,\"type\":\"cat\"},{\"id\":4,\"name\":\"doggo\",\"age\":5,\"type\":\"dog\"},{\"id\":5,\"name\":\"torto\",\"age\":3,\"type\":\"turtle\"},{\"id\":6,\"name\":\"jerry\",\"age\":1,\"type\":\"hamster\"},{\"id\":7,\"name\":\"garf\",\"age\":2,\"type\":\"cat\"},{\"id\":8,\"name\":\"milo\",\"age\":4,\"type\":\"dog\"},{\"id\":9,\"name\":\"kimi\",\"age\":2,\"type\":\"cat\"},{\"id\":10,\"name\":\"buck\",\"age\":1,\"type\":\"rabbit\"}]"
}
How can I escaped double quotes in my result data as JSON like this:
{
"StatusCode": 200,
"Message": "Hello framework - OK",
"data": [
{"id": 1,"name": "george","age": 2,"type": "dog"},
{"id": 2,"name": "walter","age": 1,"type": "rabbit"},
{"id": 3,"name": "tom","age": 1,"type": "cat"},
{"id": 4,"name": "doggo","age": 5,"type": "dog"},
{"id": 5,"name": "torto","age": 3,"type": "turtle"},
{"id": 6,"name": "jerry","age": 1,"type": "hamster"},
{"id": 7,"name": "garf","age": 2,"type": "cat"},
{"id": 8,"name": "milo","age": 4,"type": "dog"},
{"id": 9,"name": "kimi","age": 2,"type": "cat"},
{"id": 10,"name": "buck","age": 1,"type": "rabbit"}
]
}