I am looking to create a query system for my application that can be utilized by external systems for configuring based on specific conditions.
My plan is to utilize a JSON Clause tree on the backend, which will be evaluated recursively.
[
"AND",
[
{
"operator": "eq",
"field": "section1.fieldabc",
"value": "value1"
},
[
"OR",
{
"operator": "lt",
"field": "section2.fieldxyz",
"value": 5000
},
{
"operator": "gt",
"field": "section2.fieldxyz",
"value": 1000
}
]
]
]
This structure resembles an S-expression tree for representation purposes.
While I aim to have a JSON Clause Tree in Backend, I want to spare users from having to manually write this code.
Ideally, I would like to develop a query language similar to JQL (Jira Query Language) without the need for an overly complex parser.
Is there a standardized method for implementing this? Perhaps using a library to convert a standard query language (in JS or Java).
From the user's viewpoint, the above query should appear as:
section1.fieldabc == value1 AND (section2.fieldxyz < 5000 OR section2.fieldxyz > 10000)