Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
Hi, I am trying to map a JSON document which returns not only the objects but the meta data as well to a "flattened" JSON file. Basically each object in the array should be a column in the end. I have tried using the data mapper but without much success. Can anyone help. Here is a sample of the JSON document
{
"DATARECORD": [
{
"DATAFIELD": [
{
"FIELDNAME": "equipmentcode",
"FIELDLABEL": "EQUIPMENTCODE",
"DATATYPE": "MIXVARCHAR",
"FIELDVALUE": "AF0000-1",
"ISKEYFIELD": true
},
{
"FIELDNAME": "organizationcode",
"FIELDLABEL": "ORGANIZATIONCODE",
"DATATYPE": "MIXVARCHAR",
"FIELDVALUE": "RTQ",
"ISKEYFIELD": false
},
{
"FIELDNAME": "description",
"FIELDLABEL": "DESCRIPTION",
"DATATYPE": "MIXVARCHAR",
"FIELDVALUE": "AFFICHE: AF0000-1 (Temporaire/Flêches)",
"ISKEYFIELD": false
}
]
},
{
"DATAFIELD": [
{
"FIELDNAME": "equipmentcode",
"FIELDLABEL": "EQUIPMENTCODE",
"DATATYPE": "MIXVARCHAR",
"FIELDVALUE": "AF1002-1",
"ISKEYFIELD": true
},
{
"FIELDNAME": "organizationcode",
"FIELDLABEL": "ORGANIZATIONCODE",
"DATATYPE": "MIXVARCHAR",
"FIELDVALUE": "RTQ",
"ISKEYFIELD": false
},
{
"FIELDNAME": "description",
"FIELDLABEL": "DESCRIPTION",
"DATATYPE": "MIXVARCHAR",
"FIELDVALUE": "Affiche AF1002-1",
"ISKEYFIELD": false
}
]
}
]
}
Here is the output i would like to have:
{
"values": [
{
"EQUIPMENTCODE": "AF0000-1",
"ORGANIZATIONCODE": "RTQ",
"DESCRIPTION": "AFFICHE: AF0000-1 (Temporaire/Flêches)"
},
{
"EQUIPMENTCODE": "AF1002-1",
"ORGANIZATIONCODE": "RTQ",
"DESCRIPTION": "Affiche AF1002-1"
}
]
}
Is this at all possible?
Thanks for any help
Jonathan
Here is a little more information: Basically, i would need to pivot the datafield array into "columns". Every datafield array is a row, my column name is the FIELDLABEL and the value is FIELDVALUE.