Alteryx Designer Desktop Discussions

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

Remove back slashes from final json output

jakaur32
8 - Asteroid

Hello,

 

I am attaching my correct  excel input however right after json build tool backslashes get added to my final output.  which shouldn't be the case.  below is the attached final output as well as the workflow.

 

Below is the actual output i should be getting in the json format.

[
{
"areaCode": "12345",
"areaName": "12345_name",
"State": {
"City": ["York","Mills","Flushing"],
"Zip": "11800"
},
"Country": {
"NA": "America",
"EU": "Germany"
}
},
{
"areaCode": "23451",
"areaName": "23451_name",
"State": {
"City": ["Mills","Flushing"],
"Zip": "10000"
},
"Country": {
"NA": "Canada",
"EU": "Spain"
}
},
{
"areaCode": "34512",
"areaName": "34512_name",
"State": {
"City": [""],
"Zip": "30000"
},
"Country": {
"NA": "Canada",
"EU": "Spain"
}
}
]

5 REPLIES 5
MatthewBr
Alteryx Alumni (Retired)

Why don't you add a formula tool to remove the backslashes? 

MatthewBr_0-1654634956878.png

 

 

MatthewBr_1-1654634969086.png

 

IraWatt
17 - Castor
17 - Castor

@jakaur32The reason why this is happening is because the Alteryx likes you to input arrays in this format:

IraWatt_1-1654635423380.png

However if you don't want to correct your data that way you can just use a replace formula like this:

IraWatt_0-1654635199234.png 

Replace([JSON], "\", "")

Any questions or issues please ask :)
HTH!
Ira

 

jakaur32
8 - Asteroid

this almost works however when i am doing this action there is one issue. the value for city should begin with square bracket and not quotations. 

Current Output

[
{
"areaCode": "12345",
"areaName": "12345_name",
"State": {
"City": "["York","Mills","Flushing"]",
"Zip": "11800"
},
"Country": {
"NA": "America",
"EU": "Germany"
}
},
{
"areaCode": "23451",
"areaName": "23451_name",
"State": {
"City": "["Mills","Flushing"]",
"Zip": "10000"
},
"Country": {
"NA": "Canada",
"EU": "Spain"
}
},
{
"areaCode": "34512",
"areaName": "34512_name",
"State": {
"City": "[""]",
"Zip": "30000"
},
"Country": {
"NA": "Canada",
"EU": "Spain"
}
}
]

 

Expected Output

[
{
"areaCode": "12345",
"areaName": "12345_name",
"State": {
"City": ["York","Mills","Flushing"],
"Zip": "11800"
},
"Country": {
"NA": "America",
"EU": "Germany"
}
},
{
"areaCode": "23451",
"areaName": "23451_name",
"State": {
"City": ["Mills","Flushing"],
"Zip": "10000"
},
"Country": {
"NA": "Canada",
"EU": "Spain"
}
},
{
"areaCode": "34512",
"areaName": "34512_name",
"State": {
"City": [""],
"Zip": "30000"
},
"Country": {
"NA": "Canada",
"EU": "Spain"
}
}
]

IraWatt
17 - Castor
17 - Castor

Hey @jakaur32,

Heres how you can correct your input to get the JSON build to work:

IraWatt_0-1654637321484.png

 

MatthewBr
Alteryx Alumni (Retired)

@jakaur32  - Just mark that either one of these is a solution and can be closed 😀

Labels