Alteryx Designer Desktop Discussions

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

Alteryx and JSON : The "An array can't be at the top level" Discussion

Verakso
11 - Bolide

Hi Community,

I know there is plenty of answers on how to fix this, but this discussion is more, whether there is a "flaw" in the JSON Builder tool, or a discussion on what is valid JSON.

Take this JSON for example

 

[
  {
    "on": false,
    "type": "sms"
  },
  {
    "on": false,
    "type": "email"
  }
]

 

If you test it on eg. https://jsonlint.com/ it says JSON is valid!

Alteryx has not problem reading it either, but if you do a simple test like this:

 

2024-02-09 13_17_27-Alteryx Designer x64 - json.yxmd_.png

 

You can see reading is fine, but you can't write the JSON back!!

And that is what baffles me. How come, you can read something that appears to be valid JSON, but you can't write JSON that way in Alteryx.

 

Yes I do know there is hacks to do this, but my question for discussion, should you be able to write the same JSON back natively?
Personally, it the assumption is, that the JSON in this example is valid, then there is a bug in the Alteryx JSON builder.

 

8f8wbo.jpg

 /Thomas

5 REPLIES 5
Amit_G_Limbasia
8 - Asteroid

Dear @Verakso 

 

I know this may be alteyx error but you can work around by adding and removing required format :

 

Please find attached workflow for solution.

 

First add Presyntex

 

First add Presyntex 

'Record.'+[JSON_Name]

 

Remove the presyntex and make a proper json

Replace([JSON], '{"Record":', '')

Replace([JSON], Right([JSON], 3), '}]')

 

 

Find workflow for reference. Thanks Enjoy Solving!

Amit_G_Limbasia
8 - Asteroid

Dear @Verakso 

 

One more alternative solution is here 

Please find workflow

danilang
19 - Altair
19 - Altair

Hi @Verakso 

 

The JSON Build tool is taken from the Laboratory palette and if you look at the help page you'll find this text at the very top

 

Laboratory Tool

This is a Laboratory tool and isn't for production use. It might have documented known issues, might not be feature complete, and is subject to change.

 

I agree that the tool is not feature complete, with a search on "JSON build" bringing back pages of incorrect results.  On the other hand Alteryx does actually state that the tool is not production ready.  The tool is also not available OOB since you have to explicitly enable the Laboratory palette(though a search for JSON does return the tool allowing you to drop it on your canvas without realizing that it comes from the Laboratory palette)

 

Perhaps you should open an idea to get some traction around having Alteryx flesh out the tool.  

 

Dan

apathetichell
18 - Pollux

Json Parse > Json Build > XML Parse > using input data to bring in Json files as type .json.

 

 

Verakso
11 - Bolide

Oh wow @danilang 


I simply have been so used to working and using these tools, that I simply forgot that disclaimer.
But when I read the help page, it kinda makes sense, that it works this way - the tool has never been made finished.

It is just a bit curious, that the tool have been around as long as I can remember, and it is still in the Laboratory palette.

 

Your comments though makes perfect sense, and I probably will be visiting the idea page, to see if we can't get this tool further, it should be about time I think.

 

Thanks
/Thomas

Labels