Jump to content

Recommended Posts

I didn't see any obvious way to do it either.

I tried with a non-empty array as well but its values were also ignored.

Link to post
Share on other sites
  • 2 months later...
  • Replies 110
  • Created
  • Last Reply

Top Posters In This Topic

Top Posters In This Topic

Popular Posts

View File JSONtext Package for working with JSON.  Uses high-speed text parsing, rather than building an intermediate representation as with prior LabVIEW JSON librari

working on it

Definitely on my list of JSONtext additions.  Ideally, I would want to implement RFC 7396: JSON Merge Patch, with the ability to generate a "patch" of the differences between two JSON texts, then appl

Posted Images

On 7/9/2020 at 5:39 AM, Porter said:

Bug? JSONText doesn't apply input default values to missing cluster items of array elements.

image.png.cfac8c824a0c9d7cb52ca3a937cbf166.pngimage.png.8ae1b813f1c246373cf99f02b3bc8356.png

I was hoping to see "Default", 1 and "2", NaN but instead get "",1 and "2",0

I think that it is due to the behavior of the Get Array Information VI.

The workaround is to convert the array elements individually as clusters:

image.png.30316820d66dc9e23dc0c3ae7f3760c8.pngimage.png.4022f34cc2d9604696e4e09bf7fe0789.png

Note: you can also do this (using the JSONpath for all array elements) because here one is specifying the element of the array (with default) rather that an empty array:

254981577_2020-09-2315_44_57-Untitled1BlockDiagramonJSONtext.lvproj_MyComputer_.png.1c8917c4a3694ddfabfb593626f8e9f3.png

  • Thanks 1
Link to post
Share on other sites
9 hours ago, Thaddaeus Yale said:

Will this library support the new LabView Map Collection type?

No, unfortunately, as it is written in LabVIEW 2017, which does not have that type.

Link to post
Share on other sites
  • 5 weeks later...

I've been using this toolkit when passing data to a WebVI in LabVIEW NXG 5.0.0. It appears that the JSON parser built into NXG WebVIs is incapable of reading enums or timestamps. I am not certain if that is a limitation of the parser or the encoder. Are you able to shed any light on this drjdpowell?

Link to post
Share on other sites
4 hours ago, Jordan Kuehn said:

It appears that the JSON parser built into NXG WebVIs is incapable of reading enums or timestamps. I am not certain if that is a limitation of the parser or the encoder.

The "Flatten to JSON" and "Unflatten from JSON" nodes in NXG WebVIs are essentially the same as the ones built into classic LabVIEW. Both are incapable of processing enums or timestamps.

As a workaround, you can create a "bridging" typedef (GType) which replaces enums and timestamps with strings. Use that with the NXG JSON parser, and then convert it to your "real" GType.

Link to post
Share on other sites
16 minutes ago, JKSH said:

The "Flatten to JSON" and "Unflatten from JSON" nodes in NXG WebVIs are essentially the same as the ones built into classic LabVIEW. Both are incapable of processing enums or timestamps.

As a workaround, you can create a "bridging" typedef (GType) which replaces enums and timestamps with strings. Use that with the NXG JSON parser, and then convert it to your "real" GType.

Thank you for the confirmation. I have done something similar using numeric types, but it is inconvenient at best. An NXG version of this toolkit would be fantastic. 

Link to post
Share on other sites
1 hour ago, Jordan Kuehn said:

Thank you for the confirmation. I have done something similar using numeric types, but it is inconvenient at best. An NXG version of this toolkit would be fantastic. 

Unfortunately, the NXG Web module lacks both recursion and VIs for determining the data type inside a variant.  This makes porting JSONtext to it very difficult.

Link to post
Share on other sites
10 minutes ago, drjdpowell said:

Unfortunately, the NXG Web module lacks both recursion and VIs for determining the data type inside a variant.  This makes porting JSONtext to it very difficult.

I'm not surprised by this, but thank you for weighing in. Maybe when NXG reaches CG parity in 2050.

  • Haha 1
Link to post
Share on other sites
  • 3 weeks later...

Hi drjdpowell,

i found an issue converting a array of clusters from text to data. 

In the JSON text is a ":" missing between key and value. Running this results in data loss (see indicator "Data NOK") without an error.

I noticed this in Version 1.3.1.84 but can confirm it also occurs in 1.4.4.89.

best regards
Thomas

image.png.608b4921c12cf5f6dfb79b84dcf8569c.png

Issue JSON Text to Array.vi

Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

  • Similar Content

    • By drjdpowell
      Package for working with JSON.  Uses high-speed text parsing, rather than building an intermediate representation as with prior LabVIEW JSON libraries (this is much faster).  Allows easy working with "subitems" in JSON format, or one can convert to/from LabVIEW types.  Uses the new "malleable VIs" of LabVIEW 2017 to convert to any LabVIEW type directly.
      JSON text makes use of a form a JSON Path notation, allowing easy and rapid access to the subitems of interest.
      Requires LabVIEW 2017 and install by VIPM 2017 or later.
      Original conversation about JSONtext.
      On the LabVIEW Tools Network.
      JDP Science Tools group on NI.com.
      Copyright 2017 JDP Science Limited
    • By drjdpowell
      View File JSON LabVIEW
      JSON is a data interchange format (sometimes compared to XML, but simpler). There are multiple projects to create a JSON package for LabVIEW. This is yet another one motivated by this hijacked conversation originally about a different project to convert JSON into LabVIEW Variants.

      This project uses a set of LVOOP classes to match the recursive structure of JSON, rather than variants. It allows conversation to and from JSON. All functionality is available through two polymorphic VIs: Set and Get. In addition to Get and Set VIs for common data types, one can also convert directly to or from complex clusters via variant-JSON tools.

      Copyright 2012-2016 James David Powell, Shaun Rumbell, Ton Plomp and James McNally.
      [Note: if you are using LabVIEW 2017, please also see the JSONtext library as a an alternative.]
      Submitter drjdpowell Submitted 10/04/2012 Category General LabVIEW Version  
    • By ThomasGutzler
      Hi,
      I'm receiving a JSON string from a web API, which I'm trying to convert into a cluster (of clusters) but I've run into some problems:
      1) Sometimes the order of the elements in the JSON string changes, which causes my conversion to fail.
      2) Sometimes the "object" returned via JSON is null, which causes my conversion to fail if I use clusters within clusters. It works with variants in clusters but then I need to convert the all the variants manually
      Is there any way to improve my code to fix those problems? The attached snippet is a simplified version. In my project, the first JSON string to data is done in a library. The second conversion from "result" variant to data is done in my application. This makes a direct conversion from JSON string more difficult.

    • By drjdpowell
      JSON is a data interchange format (sometimes compared to XML, but simpler). There are multiple projects to create a JSON package for LabVIEW. This is yet another one motivated by this hijacked conversation originally about a different project to convert JSON into LabVIEW Variants.

      This project uses a set of LVOOP classes to match the recursive structure of JSON, rather than variants. It allows conversation to and from JSON. All functionality is available through two polymorphic VIs: Set and Get. In addition to Get and Set VIs for common data types, one can also convert directly to or from complex clusters via variant-JSON tools.

      Copyright 2012-2016 James David Powell, Shaun Rumbell, Ton Plomp and James McNally.
      [Note: if you are using LabVIEW 2017, please also see the JSONtext library as a an alternative.]
    • By Pavanb
      Hi There 
      I want to go from TestStand's output i.e. database to HTML5 SPC charts. Sorta like http://moderndata.plot.ly/using-plotly-from-labview-via-python/ Has anyone done this or used Bokeh or Enthough's data tool before?  What about these tools with TDMS or HDF5?
      Thanks. I appreciate it.
      Best,
      Pavan 
      By the way, https://www.enthought.com/services/consulting/case-studies/TAIPAN/ (like TestStand without TestStand)
       



×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use.