jruizgit / rules

Durable Rules Engine
MIT License
1.14k stars 209 forks source link

Setup rules Using JSON for Nested arrays #372

Open apurvjain17 opened 3 years ago

apurvjain17 commented 3 years ago

Hi Jesus,

I was trying to load rules using JSON for nested arrays. For arrays inside a JSON object, everything works fine. How do I access elements of an array inside another array? For instance :-

{
    "data":[{
        "package":{
            "items":[{
                "value":5
            }]
    }]
}

A rule condition with value equal to 6, the below rule throws 202 Parse Error.

"test": {
    "r_0": {
      "all": [
        {
          "m": {
            "$iall":{
                "data":{
                    "$i.package":{
                        "$iall":{
                            "items":{
                                "$i.value":6
                            }
                        }
                    }
                }
            }
          }
        }

Thanks