AnsweredAssumed Answered

How to generate each JSON array on new line in CSV file?

Question asked by brian.wilkinsonc3 on Mar 25, 2018
Latest reply on Mar 26, 2018 by SaiKumarGoud Mallari

Hi Guys,

 

I am trying to generate the CSV file from the JSON array. My JSON looks like below:

{
    "count": 2150,
    "name": "Test Data",
    "columnNames": [
        "Date Created",
        "Date Closed",
        "Last Name",
        "First Name"
    ],
    "rows": [
        [
            "'2018-03-15 09:12:28'",
            "'2018-03-15 09:12:28'",
            "Gar",
            "Jon",
        ],
        [
            "'2018-03-16 12:19:44'",
            "'2018-03-16 12:19:44'",
            "Mor",
            "Mar",
        ]
],
  "links": [
        {
            "rel": "self",
            "href": "some_address"
        },
        {
            "rel": "canonical",
            "href": "some_address_1"
        },
        {
            "rel": "describedby",
            "href": "some_address_2",
            "mediaType": "application/schema+json"
        }
    ]
}

The rows array in JSON object that I will receive is not specific size, it can be as many array inside it. I implemented the similar architecture that you have pointed here LINK. Although the problem is that I receive the whole Rows array in one string like  2018-03-15 09:12:28,2018-03-15 09:12:28,Gar,Jon,2018-03-16 12:19:44,2018-03-16 12:19:44,Mor,Mar and so on

I wanted to see each array inside Row array on new line like

2018-03-15 09:12:28,2018-03-15 09:12:28,Gar,Jon

2018-03-16 12:19:44,2018-03-16 12:19:44,Mor,Mar

 

. I have tried the following Map

 

 

 

 

 

 

 

The first Map function:

 

In the third Map function I tried resetting the document Property to null so that for every Row Array iteration I can print the inner array on new line, but no luck even with resetting the document property. I have also enabled the Map Function Ordering.

Can someone point me in right direction as to how can I implement this?

 

Any help is appreciated.

Outcomes