Deserialize JSON Array is giving error

I need help in parsing the JSON file which is an array as it is giving error:

unable to cast object of type ‘newtonsoft.json.linq.jproperty’ to type ‘newtonsoft.json.linq.jobject’

Below is the JSON Boby, where we have two JSON object in an array. Nodes are formula and list. If you observe in first element “list” is not an array and in second element “list” is an array. I have below steps applied in code. When I am using 1st element of an array same as 2nd element then I am getting correct result but with this format when 1st element format is different that 2nd element format then it is giving error. How to solve this error.

  1. Read Text File
  2. Desrialize JSON Array
  3. For each item in Desrialize JSON Array
  4. inside this loop added one more loop
    For each item in item("list)
  5. inside this loop added one more loop
    For each item in item(“rules”)

[{

“formula”: “XXXX”,

“list”:
{

    "id": 343,


    "name": "XXXX",

    "rules": [
  
              {

“rule”:
{
“decisionValue”:“XXXX”,
“decisionLevel”:“XXXX”,
},
“value”: “23”,
},
{

               "rule":
                      {

“decisionValue”:“XXXX”,

“decisionLevel”:“XXXX”,

                       },
               "value":"11",

}
]

     }

},

{

“formula”: “XXXX”,

“list”:
[

{

    "id": 343,


    "name": "XXXX",

    "rules": [
  
              {

“rule”:
{
“decisionValue”:“XXXX”,
“decisionLevel”:“XXXX”,
},
“value”: “23”,
},
{

               "rule":
                      {

“decisionValue”:“XXXX”,

“decisionLevel”:“XXXX”,

                       },
               "value":"11",

}
]

     }

,

{

    "id": 343,


    "name": "XXXX",

    "rules": [
  
              {

“rule”:
{
“decisionValue”:“XXXX”,
“decisionLevel”:“XXXX”,
},
“value”: “23”,
},
{

               "rule":
                      {

“decisionValue”:“XXXX”,

“decisionLevel”:“XXXX”,

                       },
               "value":"11",

}
]

     }

]

}]