The below JSON has had me stumped for hours.
The DataSource.Headers contains the headers for all over the values contained in the DataSource.Rows.
I'm trying to get the Header in position [0] to correspond with the value [0] in each DataSource.Rows object into a Key:Value pair response. Is this possible?
I've been tinkering with the merge
and join
functions, but can't seem to get them to work.
Here is the input JSON:
{
"DataSource": {
"Name": "Test Data",
"Headers": [
{
"Name": "ID",
"DisplayAt": "None"
},
{
"Name": "UserID",
"DisplayAt": "Title"
},
{
"Name": "Date",
"DisplayAt": "None"
},
{
"Name": "Number",
"DisplayAt": "None"
},
{
"Name": "Documentation",
"DisplayAt": "None"
},
{
"Name": "Documentation Type",
"DisplayAt": "None"
},
{
"Name": "VID",
"DisplayAt": "None"
}
],
"Rows": [
[
"bcf002c4-0466-4bdc-bef2-aca10144571c",
"e6363955-5701-415d-b18c-aca1014457b4",
"2020-01-01",
"12345",
"Test Data",
"Document",
"54321"
],
[
"633c184a-1594-4144-a1fb-aca800f81bb5",
"ebe3df2a-dfe5-4a7c-b388-aca800f81c4d",
"2021-01-01",
"99999",
"Test Data 2",
"Document 2",
"99999"
]
],
"TotalRows": 2,
"LastUpdated": "2021-01-08T03:04:02.3500000Z",
}
}
Here is the result I'm trying to get.
[
{
"ID": "bcf002c4-0466-4bdc-bef2-aca10144571c",
"UserID": "e6363955-5701-415d-b18c-aca1014457b4",
"Date": "2020-01-01",
"Number": "12345",
"Documentation": "Test Data",
"Documentation Type": "Document",
"VID": "54321",
},
{
"ID": "633c184a-1594-4144-a1fb-aca800f81bb5",
"UserID": "ebe3df2a-dfe5-4a7c-b388-aca800f81c4d",
"Date": "2021-01-01",
"Number": "99999",
"Documentation": "Test Data 2",
"Documentation Type": "Document 2",
"VID": "99999",
}
]