community
cancel
Showing results for 
Search instead for 
Did you mean: 

Alteryx designer Discussions

Find answers, ask questions, and share expertise about Alteryx Designer.
Community v19.6

Looks aren't everything... But the latest Community refresh looks darn good!

Learn More
SOLVED

Issue with Output file in JSON format

Atom

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

 

 

Highlighted
Aurora

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

 

 

Atom

Hi @danilang,

 

That worked perfectly! thanks a mil for your help!

 

Cheers,

Raj

Labels