Community Spring Cleaning week is here! Join your fellow Maveryx in digging through your old posts and marking comments on them as solved. Learn more here!

Alteryx Designer Desktop Discussions

Find answers, ask questions, and share expertise about Alteryx Designer Desktop and Intelligence Suite.
SOLVED

Issue with Output file in JSON format

RajR
6 - Meteoroid

Hi,

 

I am trying to create a control file in JSON format to accompany a data file within a workflow. Requirement is to generate the control file in the below format.

 

{
"files" : [ {
"name" : "EX_RATES_20190528124700.dat",
"path" : "/QUANTUM/EX_RATES",
"rowCount" : 110
} ]
}

 

I am creating the name, path & rowcount in a formula within the same workflow and then writing this to a output data tool in JSON format. This is what I have in the table that's going into the output data tool.

 

JSON-Data-sample.jpg

 

But, when the workflow is run, the control file output comes like below.

 

[
    {
        "files": "[ {",
        "name": "EX_RATES_20190710145039.dat",
        "path": "/QUANTUM/EX_RATES",
        "rowCount": 110
    }

 

Any help on where I am going wrong and how to get the control file output in the format required?

 

Thanks,

RajR

 

 

2 REPLIES 2
danilang
19 - Altair
19 - Altair

Hi @RajR 

 

The Alteryx .json output doesn't do any kind of nesting of data.  It just outputs your fields and value as name:value strings.  If you want a more complex structure, use the JSON builder tool.    

 

WF.png

 

This workflow takes your input record + one extra prefix field and manipulates the columns and values to get it into this format

 

Builderinput.png

 

This is the format that the JSON builder tool uses to create properly formated nested JSON strings.  The result of this is the following JSON string

 

{"files":[{"name":"EX_RATES_20190528124700.dat","path":"/QUANTUM/EX_RATES","rowcount":110}]}

 

Aside from splitting onto multiple lines, this is exactly the format that you require

 

Dan

 

 

RajR
6 - Meteoroid

Hi @danilang,

 

That worked perfectly! thanks a mil for your help!

 

Cheers,

Raj

Labels