A server is sending back such a response:
me@linux:~> curl -X GET http://*.*.*.*:8080/profiles
[
{
"ProfileID": 1,
"Title": "65micron"
},
{
"ProfileID": 2,
"Title": "80micron"
}
]
I have tried this solution to parse the response as JSON but it only works if the server response is like this:
{
"array": [
{
"ProfileID": 1,
"Title": "65micron"
},
{
"ProfileID": 2,
"Title": "80micron"
}
]
}
Does anybody know how I can parse the server response as JSON?
One idea which occurred to me is to add { "array":
to the beginning of http.Response.Body
buffer and also add }
to the its end, then use the standard solution. However, I'm not sure if that's the best idea.