Forum Discussion

jfpelletier's avatar
jfpelletier
Contributor
2 years ago
Solved

Converting an array to a JSON payload

Hello all, I need to convert an array of ID values into a JSON payload, and I cannot find any array function that can iterate the values of the list to generate what I need. My array of IDs looks l...
  • koryknick's avatar
    2 years ago

    jfpelletier - assuming this input document:

    {"ids":["r4ige6rwgvnr","4nkmdoijydfj9","6ashbd99w3"]}

    Configure a Mapper expression as follows:

    Should provide the desired output.  Take a look at the Array.map() documentation for description.  The Javascript documentation linked in the SnapLogic documentation has some excellent details and examples.  Basically the statement shown above is turning each string value in the array to an object.