Hi Team,
Please see the below JSON body from which i need to extract specific values.
{
“id”: “7702d0e6-f443-4fdb-aa4f-8b187092a08a”,
“name”: “XXX”,
“status”: “Limited Scope”,
“meetingRequestForm”: {
“id”: “9c85a89d-4feb-49b8-a9d4-8025c625799c”,
“name”: “New – XXXXX meeting request form”
},
“questions”: [
{
“id”: “def3efde-3ef1-4dc3-95ae-e0549435d9d5”,
“name”: “If no, please advise why”,
“value”: ,
“type”: “Unknown”
},
{
“id”: “24e6ea06-e55e-4c09-a2b4-e70efe4e8044”,
“name”: “Vendor Contact Name”,
“value”: ,
“type”: “Unknown”
},
{
“id”: “beea1ab6-c0c5-4556-b6bc-7da9134f1392”,
“name”: “XXXXX meeting ID”,
“value”: [
“MESXXXX”
],
“type”: “General”
}
]
}
i need to extract id from meeting request form and Vendor contact name from questions.
Could you please help me.
1 Like
@jishnu.pnair,
Here is the approach.
-
Deserialize the json into JObject.
-
Deserialize meetingRequestForm
into Dictionary(Of String, Object)
-
Deserialize questions
into List<Dictionary(Of String, Object)>
Access the final required value with this:
Full solution:
Sample Code here.
JsonOutput.xaml (10.2 KB)
Please don’t forget to mark this as solution.
Thanks,
Ashok
1 Like
@ashokkarale
I am able to get the meeting request form id.
But for the Vendor contact name its not working.
once after deserializing the JSON to Dictionary i tried this.
but getting error- disallows implicit conversion from integer to string
GetMRF_DeserializedQuestions(1)(“Vendor Contact Name”).ToString
Type of Arg used for deserializing of questions
1 Like
@jishnu.pnair ,
Change the dictionary datatype as Dictionary(Of String, Object)
1 Like
@ashokkarale
i hope this is the right one.
1 Like
Yes, it’s the correct one
I am getting error for extracting the data from questions.
when i use this dictQuestion(1)(“name”).ToString
error: implicit conversion from integer to string
@jishnu.pnair,
How you are using. Show the screenshot.
@jishnu.pnair,
Check Json once. Seems something is changed in json.
Hey @jishnu.pnair
Try Below solution
assign = "{
““id””: ““7702d0e6-f443-4fdb-aa4f-8b187092a08a””,
““name””: ““XXX””,
““status””: ““Limited Scope””,
““meetingRequestForm””: {
““id””: ““9c85a89d-4feb-49b8-a9d4-8025c625799c””,
““name””: ““New – XXXXX meeting request form””
},
““questions””: [
{
““id””: "“def3efde-3ef1-4dc3-95ae-e0549435d9d5"”,
““name””: ““If no, please advise why””,
““value””: null,
““type””: ““Unknown””
},
{
““id””: "“24e6ea06-e55e-4c09-a2b4-e70efe4e8044"”,
““name””: ““Vendor Contact Name””,
““value””: null,
““type””: ““Unknown””
},
{
““id””: ““beea1ab6-c0c5-4556-b6bc-7da9134f1392"”,
““name””: ““XXXXX meeting ID””,
““value””: [
““MESXXXX””
],
““type””: ““General””
}
]
}”
"ID : "+json_object(“meetingRequestForm”)(“id”).ToString()
"Name : "+json_object(“questions”)(1)(“name”).ToString()
Thanks and regards
Rajesh Rane