cancel
Showing results for 
Search instead for 
Did you mean: 

records to json file

manohar
Contributor

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.

manohar_0-1745975888321.png

 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

1 ACCEPTED SOLUTION

GjorgeArgirov
New Contributor

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.

GjorgeArgirov_0-1746783198539.png

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

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

View solution in original post

2 REPLIES 2

SpiroTaleski
Valued Contributor

@manohar 

Please find the attached 2 pipelines. 

Parent pipeline will extract the source data, will pass to the child, and the child pipeline will write the file with the Id in the filename. 

BR,

Spiro

GjorgeArgirov
New Contributor

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.

GjorgeArgirov_0-1746783198539.png

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

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