Articles in this section

Transform JSON arrays into objects in HTTP exports

In most cases, JSON arrays of arrays are now automatically transformed into an array of objects (with key-value pairs) to allow for proper mapping and import. When creating an HTTP export, integrator.io checks the data for an array of arrays. If the array structure is at the top level, integrator.io will automatically transform the array into an array of objects.

In the example below, the array of arrays is at the top level, so there’s no need to configure it further. Notice that the transformation from an array of arrays to an array of objects includes adding default keys (0, 1, 2, …)

Original array of arrays

{ "values":[
        [
         "Name",
         "Country",
         "Gender",
         "Bowler/Batsman"
        ],
        [
         "Allan Border",
         "Australia",
         "Male",
         "Batsman"
        ],
        [
         "Kim Hughes"
         "Australia",
         "Male",
         "Batsman"
        ]
   ]
}

New array of objects

{ "page_of_records": [
        {
         "record":{
                "0":"Name",
                "1":"Country",
                "2":"Gender",
                "3":"Bowler/Batsman"
                }
        },
        {
         "record":{
                "0":"Allan Border",
                "1":"Australia",
                "2":"Male",
                "3":"Batsman"
                }
        },
        {
         "record":{
                "0":"Kim Hughes",
                "1":"Australia",
                "2":"Male",
                "3":"Batsman"
                }
           }
]
}

If the array is not at the top level, use the Path to records in HTTP response body field to specify the relative path where the data is in the format of an array of arrays. If your data contains a header, check First record contains headers to update the records accordingly.

Original array of arrays

{ "values":[
        [
         "Name",
         "Country",
         "Gender",
         "Bowler/Batsman"
        ],
        [
         "Allan Border",
         "Australia",
         "Male",
         "Batsman"
        ],
        [
         "Kim Hughes",
         "Australia",
         "Male",
         "Batsman"
        ]
   ]
}

New array of objects with headers

{ "page_of_records": [
        {
         "record":{
                "Name":"Allan Border",
                "Country":"Australia",
                "Gender":"Male",
                "Bowler/Batsman":"Batsman"
                }
        },
        {
         "record":{
                "Name":"Kim Hughes",
                "Country":"Australia",
                "Gender":"Male",
                "Bowler/Batsman":"Batsman"
                }
           }
]
}
Was this article helpful?
0 out of 0 found this helpful

Comments

0 comments

Article is closed for comments.