cancel
Showing results for 
Search instead for 
Did you mean: 

Find a specific word in Json Object

npise
New Contributor II

In the router i am trying to route data based on below criteria

if any of the value in statusC.contains("T’) route to view1
if any of the value in !statusC.contains("T’). (does not contains) route to view2

How can i best achieve from below data

[
{
 "group" : [
{
"statusC":"T"
},
{
"statusC":"T"
}
 ]
},
{
 "group" : [
{
"statusC":"A"
},
{
"statusC":"A"
}
 ]
},
{
 "group" : [
{
"statusC":"T"
},
{
"statusC":"A"
}
 ]
},
{
 "group" : [
{
"statusC":"A"
},
{
"statusC":"T"
}
 ]
}
]

1 ACCEPTED SOLUTION

bojanvelevski
Valued Contributor

Hi @npise,

I am sure that @Supratim was referring to output0 and output1 on the router, and not to a conditional operator. Configured router with his expression will do the job :

image

View solution in original post

4 REPLIES 4

Supratim
Contributor III

@npise use the expression - jsonPath($, “$group[?(@.statusC == ‘T’)]”).length > 0 : route to view1 else view2

npise
New Contributor II

Thanks for the response

I am using a router snap and i dont think i can use conditional.

Supratim
Contributor III

@npise any expression enable snap you can use it.

bojanvelevski
Valued Contributor

Hi @npise,

I am sure that @Supratim was referring to output0 and output1 on the router, and not to a conditional operator. Configured router with his expression will do the job :

image