In C sharp, may I ask how to decompose a string containing a json array into an array with each element as a json string? Thanks!
One example of the string is as following.
var string = "[{"id": 111, "value": 22, "timestamp": "2021-09-20T02:34:17.000Z"},{"id": 112, "value_1": 23, "value_2": 24, "timestamp": "2021-09-20T02:33:17.000Z"}]"
I want to get an array as below.
var messages = new[]
{
@"{'id': 111, 'value': 22, 'timestamp': '2021-09-20T02:34:17.000Z'}",
@"{'id': 112, 'value_1': 23, 'value_2' : 24, 'timestamp': '2021-09-20T02:33:17.000Z'}"
}.AsEnumerable();
I tried to use JsonConvert.DeserializeObject(string), but it does not work with error Unexpected character encountered while parsing value: [
.
Thanks!