Forum Discussion

Garrett's avatar
Garrett
New Contributor II
5 years ago
Solved

JSON returns Column Names separately from the Rows

I have a REST API that returns something like the following:

entity":
{
“items”:
[
{
“tableName”:
“mytable”
“count”:
7995
“columnNames”:
[
“c1”,“c2”,“c3”,“c4”
]
“rows”:
[
[r1c1value,r1c2value,r1c3value,r1c4value],[r2c1value,r2c2value,r2c3value,r2c4value],[…],[…],[…],[…],[…],[…],[…],[…]
]
}
]
}

When I refer to jsonPath($, “entity.items[*]”) it gives me columns as an array of columns and the rows are an array of rows.

How can I parse this so that I can map it to a Mapper to put into SQL?

Thanks

  • NAl's avatar
    NAl
    4 years ago

    Hi @Spiro_Taleski,

    After attempting lots of variations, this one did the trick:
    'CUSTOM_FIELD__c = TRUE'

    As always thanks for your help

7 Replies

  • rashmi's avatar
    rashmi
    New Contributor III

    PIMData.txt (1.8 KB)

    hi @bojanvelevski i was trying to frame that structure will share the sample input and xsd pls could u help pls
    samplerecords.json (262 Bytes)
    Please convert PIMData.txt to PIMData.xsd as the template is in that format
    Please also find output expected xml in txt format
    outputxml.txt (3.2 KB)

    • alchemiz's avatar
      alchemiz
      Contributor III

      Hi rashmi,

      Good day, instead of using an xml generator snap have you tried the xml formatter? I don’t know if this is your required output but xml formatter accepts an outgoing format as XSD

      XML output using PIMData.xsd

      Updates:

      ,

      I’m not that familliar with XSD so I manipulate the sample input using a mapper snap, attached poc pipeline

      canvas 15_2022_12_03.slp (16.8 KB)

      Thanks,
      EmEm