Hi,
How to convert below JSON into regular expression using JSON Parse?
JSON Input:
{
"field":null,
"operator":null,
"value":null,
"combinator":"or",
"not":false,
"rules":[
{
"field":"MonthCount",
"operator":">=",
"value":"2",
"combinator":null,
"not":false,
"rules":null
},
{
"field":"StatusCode",
"operator":"=",
"value":"8",
"combinator":null,
"not":false,
"rules":null
},
{
"field":"Indicator",
"operator":"=",
"value":"Y",
"combinator":null,
"not":false,
"rules":null
},
{
"field":"Date",
"operator":"is not null",
"value":null,
"combinator":null,
"not":false,
"rules":null
},
{
"field":null,
"operator":null,
"value":null,
"combinator":"and",
"not":false,
"rules":[
{
"field":"lien",
"operator":"=",
"value":"true",
"combinator":null,
"not":false,
"rules":null
},
{
"field":"derivedCount",
"operator":">=",
"value":"2",
"combinator":null,
"not":false,
"rules":null
}
]
}
]
}
Out put:
((MonthCount >= 2) OR (StatusCode = 8 OR (Indicator = "Y") OR (Date is not null) OR ((lien = true) AND (derivedCount >= 2)))
Thanks,
Mark
Thank you @BrandonB / @Qiu for your response.
I am unable to achieve the below JSON to string format. Could you let me know if any solution?
JSON | STRING |
{"field":null,"operator":null,"value":null,"combinator":"and","not":false,"rules":[{"field":"Number","operator":"is null","value":null,"combinator":null,"not":false,"rules":null}]} | ((Number is null)) |
{"field":null,"operator":null,"value":null,"combinator":"and","not":false,"rules":[{"field":"Id","operator":"in","value":"TEST123, TEST234, TEST567, TEST789","combinator":null,"not":false,"rules":null},{"field":"Code","operator":"=","value":"14","combinator":null,"not":false,"rules":null}]} | ((Id in ('TEST123', 'TEST234', 'TEST567', 'TEST789')) AND (Code = 14)) |
{"field":null,"operator":null,"value":null,"combinator":"and","not":false,"rules":[{"field":"Flg","operator":"=","value":"Y","combinator":null,"not":false,"rules":null}]} | ((Flg = 'Y')) |
{"field":null,"operator":null,"value":null,"combinator":"and","not":false,"rules":[{"field":"Code","operator":"=","value":"1","combinator":null,"not":false,"rules":null},{"field":"Flg","operator":"=","value":"Y","combinator":null,"not":false,"rules":null}]} | ((Code = 1) AND (Flg = 'Y')) |
{"field":null,"operator":null,"value":null,"combinator":"and","not":false,"rules":[{"field":"Code","operator":"=","value":"19","combinator":null,"not":false,"rules":null},{"field":null,"operator":null,"value":null,"combinator":"or","not":false,"rules":[{"field":null,"operator":null,"value":null,"combinator":"and","not":false,"rules":[{"field":"Cnt","operator":">=","value":"12","combinator":null,"not":false,"rules":null},{"field":null,"operator":null,"value":null,"combinator":"or","not":false,"rules":[{"field":"Code","operator":"=","value":"1","combinator":null,"not":false,"rules":null},{"field":"Code","operator":"is null","value":null,"combinator":null,"not":false,"rules":null},{"field":"Mth","operator":"<","value":"6","combinator":null,"not":false,"rules":null},{"field":"Mth","operator":"is null","value":null,"combinator":null,"not":false,"rules":null}]}]},{"field":"Dcd","operator":"=","value":"8","combinator":null,"not":false,"rules":null},{"field":"Ind","operator":"=","value":"Y","combinator":null,"not":false,"rules":null},{"field":"Dt","operator":"is not null","value":null,"combinator":null,"not":false,"rules":null},{"field":null,"operator":null,"value":null,"combinator":"and","not":false,"rules":[{"field":"Lien","operator":"=","value":"Y","combinator":null,"not":false,"rules":null},{"field":"Mth","operator":">=","value":"2","combinator":null,"not":false,"rules":null}]},{"field":null,"operator":null,"value":null,"combinator":"and","not":false,"rules":[{"field":"Lien","operator":"=","value":"N","combinator":null,"not":false,"rules":null},{"field":"Mth","operator":">=","value":"2","combinator":null,"not":false,"rules":null}]}]}]} | ((Code = 19) AND (((Cnt >= 12) AND ((Code = 1) OR (Code is null) OR (Mth < 6) OR (Mth is null))) OR (Dcd = 18) OR (Ind = 'Y') OR (Dt is not null) OR ((Lien = 'Y') AND (Mth >= 2)) OR ((Lien = 'N') AND (Mth >= 2)))) |
User | Count |
---|---|
106 | |
82 | |
70 | |
54 | |
40 |