In case you missed the announcement: The Alteryx One Fall Release is here! Learn more about the new features and capabilities here
ACT NOW: The Alteryx team will be retiring support for Community account recovery and Community email-change requests Early 2026. Make sure to check your account preferences in my.alteryx.com to make sure you have filled out your security questions. Learn more here
Start Free Trial

Alteryx Designer Desktop Discussions

Find answers, ask questions, and share expertise about Alteryx Designer Desktop and Intelligence Suite.

JSON Parse into regular string

mark_paul
8 - Asteroid

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

3 REPLIES 3
BrandonB
Alteryx
Alteryx

Not sure if this is the ideal approach, but I basically parsed and crosstabbed the data then used the summarize tools to concatenate based on the specified logic. This seems to get the job done, but there may be a better way. 

 

one approach.png

 

 

Qiu
21 - Polaris
21 - Polaris

@mark_paul 

Something like this?

0106-mark_paul-1.PNG

mark_paul
8 - Asteroid

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?

JSONSTRING
{"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))))
Labels
Top Solution Authors