Hello All, we are facing challenges in extracting specific out from Json response in String format.
The given below is sample output response.
{“id”:“chatcmpl-7TQErCPiyCSHplw6BoGYHEnmnLFfu”,“object”:“chat.completion”,“created”:1687246729,“model”:“gpt-35-turbo”,“choices”:[{“index”:0,“finish_reason”:“stop”,“message”:{“role”:“assistant”,“content”:“False.”}}],“usage”:{“completion_tokens”:2,“prompt_tokens”:29,“total_tokens”:31}}
From the above output we need to know if content is False or true, is short what is value of content from above response output.
Can someone help us this issue.
Imports Newtonsoft.Json.Linq
Dim jsonObject As JObject = JObject.Parse(jsonResponse)
Dim contentValue As String = jsonObject("choices")(0)("message")("content").ToString()
If contentValue = "True" Then
LogMessage("Content is True")
ElseIf contentValue = "False" Then
LogMessage("Content is False")
Else
LogMessage("Content is neither True nor False")
End If