I've some JSON data coming back as a string that looks like (copy and paste from VS text visualizer):
{
"error":0,
"result":{
"name":"wjetestuser1",
"id":"0eu0_User_2_0b4cfb616e648d4792056c1a6e7d801e_null",
"status":"ACTIVE"
}
}
{
"match":[
[
"domain.id",
"=",
"2"
],
[
"loginName",
"=",
"wjetestuser1"
]
],
"return":[
"name",
"id",
"status"
]
}
I'm trying to turn this into a List for everything after the "result":
and before {"match":
without using a replace command, so I'll end up with a list that looks something like:
Name, wjetestuser1 id, 0eu0_User_2_0b4cfb616e648d4792056c1a6e7d801e_null status, ACTIVE
If I can get the error code status back thats a bonus, but really not needed.
I'm hoping there is a simple one (or a few liners) that don't involve hacking the string apart with a replace regex command.
Various code attempts so far, but this worked for me if I strip before and including "result":
and after and including {"match":
s below is the output above as a single line
s = commonCode.ExeApiCall(url);
var DSData = new List<KeyValuePair<string, string>>();
var jsonData = Newtonsoft.Json.JsonConvert.DeserializeObject<dynamic>(s);
errors at the 3rd line down with error:
Additional text encountered after finished reading JSON content: {. Path '', line 1, position 119.