I am trying to manipulate a nested query string in JavaScript. The string looks like this:
var str = "( ( Sentence starts with any of null AND Sentence starts with any of null ) AND Sentence starts with any of null )"
I want to split the string at the 'AND' operator and convert it into a JSON object structure. The desired output should resemble this:
{
"group":{
"operator":"AND",
"rules":[
{
"group":{
"operator":"AND",
"rules":[
object1,
object2
]
}
},
object3
]
}
}