cancel
Showing results for 
Search instead for 
Did you mean: 

Array vs Non Array

manohar
Contributor

hi there, I have 2 json files. one has the array and the other one has non-array child-structure.

The parent is also array. At the parent level I get individual records but when it comes to Child, if its non-array, then it mashes up the childs for each of the parent. it works fine if the child is also array.

Please find below the 2 files. E1EDPT2 is the child thats causing issue.

I am also attaching my pipeline one for the array and the other for non-array one. both having same mapping.

Can anyone please check and let me know where I m doing wrong?

Any help is greatly appreciated.

Thanks
Manohar
for_Non-Array_Text.slp (4.7 KB)
for_Array_Text.slp (5.2 KB)

non-array

[
  {
    "LINES": [
      {
        "POSEX": "00010",
        "E1EDPT1": {
          "E1EDPT2": {
            "TDLINE": "Line 10 non-array text"
          }
        }
      },
      {
        "POSEX": "00020",
        "E1EDPT1": {
          "E1EDPT2": {
            "TDLINE": "Line 20 non-array text"
          }
        }
      },
      {
        "POSEX": "00030",
        "E1EDPT1": {
          "E1EDPT2": {
            "TDLINE": "Line 30 non-array text"
          }
        }
      }
    ]
  }
]

array text

[
  {
    "LINES": [
      {
        "POSEX": "00010",
        "E1EDPT1": {
          "E1EDPT2": [
            {
              "TDLINE": "This is the First array text being sent."
            },
            {
              "TDLINE": "This is the second line of First array text being sent"
            }
          ]
        }
      },
      {
        "POSEX": "00020",
        "E1EDPT1": {
          "E1EDPT2": [
            {
              "TDLINE": "This is the second array text being sent."
            },
            {
              "TDLINE": "This is the second line of second array text being sent"
            }
          ]
        }
      },
      {
        "POSEX": "00030",
        "E1EDPT1": {
          "E1EDPT2": [
            {
              "TDLINE": "This is the third array text being sent."
            },
            {
              "TDLINE": "This is the second line of third array text being sent"
            }
          ]
        }
      }
    ]
  }
]
6 REPLIES 6

Ditto that last response: Using the Mapping root is the better approach, IMO.

manohar
Contributor

@rsramkoski, that did the trick. thank you very much for your help.

Manohar