I have a API response in Newtonsoft.Json.Linq.JArray, I need to get a few set of data from the response rendered. Can anyone help me.
Regards
Harsh
I have a API response in Newtonsoft.Json.Linq.JArray, I need to get a few set of data from the response rendered. Can anyone help me.
Regards
Harsh
This returns value of specified key in JSON : JArray.Selecttoken(“Json Key”)
Thanks
Which activity do i need to use?
@Harsh_Dixit, Use Assign activity to get the value some string variable = JArray.Selecttoken(“Json Key”).tostring
Regards,
Dominic
I have tried it but its not working
@Harsh_Dixit,
Can you share your screenshot / Xaml to have a detailed idea ?
The system is allowing me to upload any document.
Let me explain
I have a API response in json which I have successfully parsed using deserialized activity. JSON given below -
[
{
“status”: 1,
“statusStr”: “Critical”,
“entity”: “4_CPUUSAGE”,
“severity”: “
Critical”,
“who”: “Unacknowledge”,
“message”: “CPU Utilization is 52%, threshold value for this monitor is 50%: Top 3 Processes:-svchost#19 - 51.717%;WmiPrvSE#1 - 1.398%;WmiPrvSE#2 - 1.398%”,
“modTime”: “20 Sep 2017 01:35:36 PM IST”,
“category”: “Desktop”,
“numericSeverity”: 1,
“deviceName”: “in2-noisr-svn1.in2ittech.local”,
“severityString”: “Critical”,
“displayName”: “In2-noisr-svn1”,
“modTimeLong”: 1505894736223,
“statusNum”: 1
},
{
“status”: 2,
“statusStr”: “Trouble”,
“entity”: “6_DiskUtilization”,
“severity”: “
Trouble”,
“who”: “Unacknowledge”,
“message”: “Disk Utilization is 41%, threshold value for this monitor is 40%”,
“modTime”: “20 Sep 2017 12:15:39 PM IST”,
“category”: “Desktop”,
“numericSeverity”: 2,
“deviceName”: “in2-noisr-svn1.in2ittech.local”,
“severityString”: “Trouble”,
“displayName”: “In2-noisr-svn1”,
“modTimeLong”: 1505889939761,
“statusNum”: 2
}
]
Now I want the following fields in to be consumed by another API -
modTime
deviceName
displayName
entity
Can you help me achieve the same.
@Harsh_Dixit, Now i understood the problem, whatever you have attached below,
[
{
“status”: 1,
“statusStr”: “Critical”,
“entity”: “4_CPUUSAGE”,
“severity”: " Critical",
“who”: “Unacknowledge”,
“message”: “CPU Utilization is 52%, threshold value for this monitor is 50%: Top 3 Processes:-svchost#19 - 51.717%;WmiPrvSE#1 - 1.398%;WmiPrvSE#2 - 1.398%”,
“modTime”: “20 Sep 2017 01:35:36 PM IST”,
“category”: “Desktop”,
“numericSeverity”: 1,
“deviceName”: “in2-noisr-svn1.in2ittech.local”,
“severityString”: “Critical”,
“displayName”: “In2-noisr-svn1”,
“modTimeLong”: 1505894736223,
“statusNum”: 1
},
{
“status”: 2,
“statusStr”: “Trouble”,
“entity”: “6_DiskUtilization”,
“severity”: " Trouble",
“who”: “Unacknowledge”,
“message”: “Disk Utilization is 41%, threshold value for this monitor is 40%”,
“modTime”: “20 Sep 2017 12:15:39 PM IST”,
“category”: “Desktop”,
“numericSeverity”: 2,
“deviceName”: “in2-noisr-svn1.in2ittech.local”,
“severityString”: “Trouble”,
“displayName”: “In2-noisr-svn1”,
“modTimeLong”: 1505889939761,
“statusNum”: 2
}
]
Syntax:
foreach( Jobject item in J1.SelectToken(“Values”) )
{
string statusVal= item.SelectToken(“status”);
}
Yes, JObject works when we use variable name “jobject” and variable type jobject with Default value to “new jobject” then parse will work
Hello attached jobject sample workflowJobject.xaml (6.5 KB)
Use Jobject variable as new Jobject and parse string.