I have one specific issue, which I'm not able to handle.
I'm using HTTP Get API request and I'm getting JSON string, which I'm deserializing, this works perfectly. But then, I need to reuse just two pairs of this JSON file, but it needs to be pasted as JSON body for POST request. Let me show you the example:
Output of GET API Request:
{
"message":{
"value":[
{
"Reference":null,
"Key":"abc",
"IssueNumber":123
},
{
"Reference":null,
"Key":"def",
"IssueNumber":345
}
]
}
}
So now Im able to deserialize this JSON string (i.e.: jsonString("value)(0)("Key") and I will get "abc").
But now, I have no idea, how to serialize this deserialized object to use ReviewStatus and Key. This POST request JSON body looks like that:
{
"newStatus":"New"
"queueItems": [
{
"Key":"abc"
"IssueNumber":123
},
{
"Key":"def"
"IssueNumber":456
}
]
}
For loop works for me, but in that case, I will do API call for each item instead of doing just one POST API call. What would be the best solution in your opinion? I was trying to use Newtonsoft.Json.JsonConvert (SerializeObject Method), but it didn't work for me as I expected. I'm pretty sure, that there needs to be something much easier, but I need your help.
Thanks for any advice. Frantisek