Application uses Apache Cayenne.
I receive a string in the following format. This string is available for me in HashMap format as well.
{And=[(effectiveDate >= Tue Sep 01 00:00:00 EDT 2015), {And=[(loanType = 2), {Or=[{And=[{Not=[(specialFeaturesString like "*003* ")]}, {Not=[(specialFeaturesString like "*007*")]}]}, (specialFeaturesString like "*007*")]}, (specialFeaturesString like "*808*")]}]}
I would like to covert the above string to json format like below
{ "condition": "AND", "rules": [ { "id": "eDate", "field": "eDate", "type": "date", "input": "text", "operator": "greater_or_equal", "value": "2015/09/01" }, { "condition": "AND", "rules": [ { "id": "loanType", "field": "loanType", "type": "string", "input": "text", "operator": "equal", "value": "2" }, { "condition": "OR", "rules": [ { "id": "specialFeatureText", "field": "specialFeatureText", "type": "string", "input": "text", "operator": "equal", "value": "*707*" }, { "condition": "AND", "rules": [ { "id": "specialFeatureText", "field": "specialFeatureText", "type": "string", "input": "text", "operator": "not_equal", "value": "*003*" }, { "id": "specialFeatureText", "field": "specialFeatureText", "type": "string", "input": "text", "operator": "not_equal", "value": "*007*" } ] } ] }, { "id": "specialFeatureText", "field": "specialFeatureText", "type": "string", "input": "text", "operator": "equal", "value": "*808*" } ] } ] }
I may have to create POJOs and loop through the Map to to achieve this. Perhaps some recursion is involved.
I eventually feed the above json to jquery querybuilder.
Thank you for your help.