Raja.G
(Mr.RPABot)
February 1, 2023, 12:41pm
1
Hi Team,
I have below json array i want to get result based on input variable value
If i give YYY value input i want TestStatus1 value “Ghi”.
If i give XXX value input i want TestStatus1 value “Abc”
Json below ,
Please anyone help me for this
[
{
“Test1” : “XXX”,
“TestStatus1”:“Abc”,
"TestStatus2:“Def”
},
{
“Test1” : “YYY”,
“TestStatus1”:“Ghi”,
"TestStatus2:“Jkl”
},
]
Regards,
Raja G
ppr
(Peter Preuss)
February 1, 2023, 12:50pm
2
Output: myJArray
We assume a single match is to expect:
Last one shows the return, when item is not within the JArray
myJArray.Values(Of JObject).Where(Function (x) x("Test1").Value(Of String).Equals("XXX")).Select(Function (x) x("TestStatus1").Value(Of String)).FirstOrDefault()
1 Like
Raja.G
(Mr.RPABot)
February 1, 2023, 1:50pm
3
Hi @ppr ,
I getting error below,
"Where is not member of 'Newtonsoft.Json.Linq.JObject.
Regards,
Raja G
ppr
(Peter Preuss)
February 1, 2023, 1:53pm
4
screenshots are done within UiPath immediate panel:
Understanding the 6 Debugging Panels of UiPath in the easiest way possible! - News / Tutorials - UiPath Community Forum
Yes, the error message is valid. But shared code line is using Where from the return of Values(…)
Just share with us your statement / modelling details
Raja.G
(Mr.RPABot)
February 1, 2023, 2:02pm
5
Hi @ppr ,
I have attached xaml below
JsontoText.zip (2.5 KB)
Raja.G
(Mr.RPABot)
February 1, 2023, 2:35pm
6
Hi @ppr ,
Please can u share xmal file .
Regards,
Raja G
ppr
(Peter Preuss)
February 1, 2023, 3:34pm
7
Assign Activity:
myStatus1 =
mjArray.Values(Of JObject).Where(Function (x) x("Test1").Value(Of String).Equals("XXX")).Select(Function (x) x("TestStatus1").Value(Of String)).FirstOrDefault()
For sure you should work with a valid JSON Sample. Find your corrected one here:
Json.txt (158 Bytes)
system
(system)
Closed
February 4, 2023, 3:42pm
9
This topic was automatically closed 3 days after the last reply. New replies are no longer allowed.