Showing results for 
Search instead for 
Did you mean: 

anything input, like the builtin JSON nodes

Go to solution

Hi! I'm making a SubVI that takes some input data, turns it into JSON, and sends it to a server following some predetermined convention (HTTP REST). The very nice thing about the builtin JSON nodes is that they take "anything" as input, and I'd like to wire that input directly outside of the SubVI. When I right click on the "Anything" input and then "Create Control", though, an empty cluster turns up, and if I try to use that as input, the SubVI will actually want an empty cluster and not anything.

0 Kudos
Message 1 of 6

Hi Fresco,


when you want an input to take "anything" you should use a variant

Best regards,

using LV2016/2019/2021 on Win10/11+cRIO, TestStand2016/2019
Message 2 of 6

Thanks, I'm not sure how to go about that though. The Flatten to JSON node doesn't accept Variant Controls as input, nor does it accept the LabView-data conversion of that control.


Sorry if it seems that I want a readymade answer, I just don't know where to look for a solution to this.

0 Kudos
Message 3 of 6

Hi Francesco,


reading the Flatten to JSON function hel, you need to use the following data type:

This input accepts arrays and clusters of Booleans, floating-point numbers, and strings. anything can also accept an array of clusters, or a cluster of arrays, of these data types.


Try to format data in the right way.


Kind regards.


NI Italy

AE Dept.

Message 4 of 6

That's a shame that it doesn't accept a variant input (like xml, configuration, variant attribute VIs etc.) means you can't easily wrap it in a SubVI...


As for the topic of this post - you could look at one of the 3rd party JSON toolkits...there are a few floating about and they will likely accept a variant as the input.

LabVIEW Champion, CLA, CLED, CTD
Message 5 of 6
Accepted by topic author FrescoMaone

Thanks Cla_Cup and thanks Sam_Sharp.


In the end I decided to avoid the problem altogether and to leave the FlattenToJSON node out of the SubVI. I instructed my client to insert a snippet containing the FlattenToJSON node linked to the SubVI node instead of just the SubVI node. That just seemed like a cleaner solution, I didn't want to download third party libraries to replicate a function that LabView already has.

0 Kudos
Message 6 of 6