I'm making HTTP requests to a server and I my response comes back as a string in the following format:
[
{
"key1": "val1"
},
{
"key2": "val2"
}
]
So it is given back as a string list and each 'element' in the string is a JSON string.
What is the most effective way to retrieve each json?
I'd strip the square brackets on the first and last and then do a string.split({regex})
to get a string array but I'm not sure if that's the best way?
But the regex might get quite convoluted as I can't just split on ","
as some key value pairings could have a list as values which will also include ","
so determining when the first json actually starts might be tricky.
Are there any libraries that can help?
Thanks