Forum Discussion

manohar's avatar
manohar
Contributor
3 months ago
Solved

records to json file

Hi there,

I am pulling data from Coupa to store it in json files. its coming in below format. I need to create a JSON file for each record and store it into sftp server with id as file name. 

input 

 

[
  {
    "statusLine": {
      "protoVersion": "HTTP/1.1",
      "statusCode": 200,
      "reasonPhrase": "OK"
    },
    "entity": [
      {
        "id": 41728,
        "created-at": "2025-04-29T15:26:38-07:00",
        "updated-at": "2025-04-29T15:35:14-07:00",
        "po-number": "4501939775"
      }
    ],
    "headers": {
      "strict-transport-security": "max-age=31536000; includeSubDomains;",
      "x-content-type-options": "nosniff",
      "vary": "Accept",
      "x-runtime": "0.692075"
    }
  }
]

 

heres my pipeline with one record.

 after my union, i get following 

 

[
  {
    "fileName": "41728"
  },
  [
    {
      "id": 41728,
      "created-at": "2025-04-29T15:26:38-07:00",
      "updated-at": "2025-04-29T15:35:14-07:00",
      "po-number": "4501939775"
    }
  ]
]

 

what I am trying to do is use the id and storing it in filename so I can use that for the file name.  but in fact what i want in the file is just below.

 

{
      "id": 41728,
      "created-at": "2025-04-29T15:26:38-07:00",
      "updated-at": "2025-04-29T15:35:14-07:00",
      "po-number": "4501939775"
}

 

how can I achieve that? also how can I get the Id to be the filename.json like in below example, 41728.json

Thanks

Manohar

  • Simpler Alternative
    If you only need the document ID as the filename, you can set the Binary Header property in the JSON Formatter snap to the ID field.

    I’ve attached a sample pipeline that shows the settings in action.

    Hope it helps—let me know if any part isn’t clear!