avian2 / jsonmerge

Merge a series of JSON documents.
MIT License
214 stars 25 forks source link

Problem with nested json, need help #61

Open peterrre opened 1 year ago

peterrre commented 1 year ago

Hi,

i have the following issue and I need help. Hopefully my schema settings are wrong.

example1.json

{
    "exampleList": [
       {
          "field": "",
          "field1": "",
          "field2": "",
          "field3": "",
          "field4": "",
          "field5": "",
          "field6": "",
          "field7": false,
          "field8": 10,
          "deeperExampleList": [
             {
                "field": "This is my Entry",
                "field1": "",
                "deeperDeeperExampleList": [
                   {
                     "field": "",
                     "field2": "",
                     "field3": true
                   },
                   {
                     "field": "",
                     "field2": "",
                     "field3": false
                   }
                ]
             }
          ],
          "deeperExampleList1": [
             {
                "field": "",
                "deeperDeeperExampleList1": [
                   {
                     "field": "",
                     "field1": "",
                     "field2": "",
                     "field3": ""
                   },
                   {
                     "field": "",
                     "field1": "",
                     "field2": "",
                     "field3": ""
                   },
                   {
                     "field": "",
                     "field1": "",
                     "field2": "",
                     "field3": ""
                  }
                ]
             }
          ]
       }
    ]
 }

example2.json

{
    "exampleList": [
       {
          "field": "",
          "field1": "",
          "field2": "",
          "field3": "",
          "field4": "",
          "field5": "",
          "field6": "",
          "field7": false,
          "field8": 10,
          "deeperExampleList": [
             {
               "field": "I want append this",
               "field1": "",
               "deeperDeeperExampleList": [
                  {
                    "field": "",
                    "field2": "",
                    "field3": true
                  }
               ]
            }
          ],
          "deeperExampleList1": [
             {
                "field": "",
                "deeperDeeperExampleList1": [
                   {
                     "field": "",
                     "field1": "",
                     "field2": "",
                     "field3": ""
                   },
                   {
                     "field": "",
                     "field1": "",
                     "field2": "",
                     "field3": ""
                   },
                   {
                     "field": "",
                     "field1": "",
                     "field2": "",
                     "field3": ""
                  }
                ]
             }
          ]
       }
    ]
 }

schema:

schema = {
"properties": {
   "exampleList": {
      "items":{
         "properties": {
            "deeperExampleList": {
               "mergeStrategy": "append",
               }
            }
         }
      }
   }
}

What I want:

{
    "exampleList": [
       {
          "field": "",
          "field1": "",
          "field2": "",
          "field3": "",
          "field4": "",
          "field5": "",
          "field6": "",
          "field7": false,
          "field8": 10,
          "deeperExampleList": [
             {
                "field": "This is my Entry",
                "field1": "",
                "deeperDeeperExampleList": [
                   {
                     "field": "",
                     "field2": "",
                     "field3": true
                   },
                   {
                     "field": "",
                     "field2": "",
                     "field3": false
                   }
                ]
             },
             {
               "field": "I want append this",
               "field1": "",
               "deeperDeeperExampleList": [
                  {
                    "field": "",
                    "field2": "",
                    "field3": true
                  }
               ]
            }
          ],
          "deeperExampleList1": [
             {
                "field": "",
                "deeperDeeperExampleList1": [
                   {
                     "field": "",
                     "field1": "",
                     "field2": "",
                     "field3": ""
                   },
                   {
                     "field": "",
                     "field1": "",
                     "field2": "",
                     "field3": ""
                   },
                   {
                     "field": "",
                     "field1": "",
                     "field2": "",
                     "field3": ""
                  }
                ]
             }
          ]
       }
    ]
 }

What am I doing wrong?