AJITH_SK
(AJITH KUMAR )
1
Hi Team, above mentioned api Response, i need to check particular key found or not. If key found the then fetch the value.
Ex. Condition 1 : abcd found - i need True.
abcd not found - i need false value.
Without contains method any possible Way’s there pls share ur solutions.
Thanks
mkankatala
(Mahesh Kankatala)
4
Hi @AJITH_SK
If possible could you share your Input file
AJITH_SK
(AJITH KUMAR )
5
{
“data”:{
“query” : “”,
“hrf” : “”,
“scode” : “1”,
“smsg” : “Successful”,
“status” : null,
“errorcode” : null,
“emsg” : null,
“out_value” : [
{
“abcd” : “1234”,
“omnc” : “0004”,
“star” : “RST”,
“qes” : “avi”,
“aurd” : “R”,
“ors” : “”,
“Ids” : “12674”,
}
]
}
}
Parvathy
(PS Parvathy)
6
Hi @AJITH_SK
Consider the below for the JsonObject
Bool_Var = JObject("data")("out_value")(0).Value(Of String)("abcd") IsNot Nothing
Regards
1 Like
ppr
(Peter Preuss)
7
Prototype mini sample data:

we can use the ContainsKey method from the JOBject:

OR ( with some constraints) a greedy JSON Path along with SelectTokens and Any()

it is changing more the case as a different aim makes less required the abcd check or let it be more integrated
Options:
Crosscheck - checking a nonexisting key:
Alternates (more are possible)

Crosscheck - not present behaviour:

1 Like
pikorpa
(Piotr Kołakowski)
8
Hey @AJITH_SK
try this:
isKeyFound = jsonObject("data")("out_value")(0).ToObject(Of JObject).ContainsKey("abcd")
Example workflow:
- Deserialize JSON.
- Assign
isKeyFound
- If isKeyFound:
- Then Section -fetches and assigns the value of “abcd” to
keyValue
jsonObject("data")("out_value")(0)("abcd").ToString()
- Else Section - handles the case where “abcd” does not exist.
1 Like
system
(system)
Closed
9
This topic was automatically closed 3 days after the last reply. New replies are no longer allowed.