Jump to content

Recommended Posts

  • 3 months later...
Posted

Hello,

I used JSONtext library in my old project and now I tried to brush this project and install this library through VIPM to Labview 2023 again ... There appeared an error concerning dependencies "VIPM couldn't download the package JDP Science Common Utilities v1.4.1.18 from the remote server ... Could you please check availability of this package?

Thanks

Jiri

 

Posted

In the context of this VI, "empty string" refers to the JSON terminal. If you don't provide any input, it will return null. Otherwise, it returns an error.

image.png.08c97074bb8762bdbf8f1dc3c73f09be.png

Posted

I will change the terminal name to "Format empty input as null" to prevent reading it as referring to JSON Strings in the input rather than the entire LabVIEW string.   And I'l try and give a better description:

2025-01-1509_16_13-ContextHelp.png.91abdb4948206d5b62f56cca0105e93c.png

  • Like 1
  • 4 months later...
Posted

When passing a "no error" error cluster to the "To JSON Text.vim" VI of the JSONtext toolkit, the output string is empty.

This is not the expected behavior.

I would expect:

  status = false
  code = 0
  source =

Tested with v1.9.1.125 in LV 2021 SP1 on Windows

Posted

My apologies, I must have had a brain fart when I looked into that (I suspect isolating the vim from the VI I was using it and not connecting a "no error" constant to the input)?

Things work as they should upon checking again.

  • 2 weeks later...
Posted (edited)

Hi, I am using jsontext library in a project which I have been asked to localize to Chinese but get "??" out when using from jsontext.

Is there a way to do this that I am missing, or am I doing something fundamentally wrong. 

The dev PC in windows has all the localization / regions set to Chinese.
 

image.png.a62a42e0c10eca2ced4ad44f57982d00.png

Thank you

Edited by barryc4
Posted

JSON is always in UTF-8, and JSONtext will try and convert to your computer's character set automatically, so I don't think you need any of that stuff that has "UTF8".  Try simply using the single function to convert to a 2D array of strings.

However, by sure you are actually passing true JSON, with UTF8 encoding, not whatever your computer is using.  

Posted

Thank you,

The issue was I was binding the string to a sqlite db as a "utf-8 string" then reading it as a "string", which is why it was causing it to fail.

I have made the execute sql vi read it as a single utf-8 which fixed it. 

image.png.86778a7cdeefbe7f2f4787ffaff7e572.png

  • 8 months later...
Posted

Hi! Thanks for the awesome tool. I am seeing an issue that was reported also earlier in this thread (page 3), but I didn't see any further discussion about it.

The problem is 'To JSON Text.vim' not handling variant names, when converting from LabVIEW data type to JSON string. I am trying to convert a cluster that has some variant fields, but in the resulting JSON string the variant field names are empty. More over, if I have a variant as the first field in my cluster, the resulting JSON string is actually a JSON array instead of an object (which, according to documentation, should be the case, if the first field in the cluster is unnamed). To my understanding my variant fields do have names. Is this a bug or some mistake in my end?

Here are some snips from a test VI to demonstrate the issue.

image.png.ab3ea7a059cec720ffd1d9122156bb1c.png     image.png.eadf5f793ba7d1a158616555c302b046.png

Posted

Can't find a way to edit my previous post, so continuing here. After posting, I found the related discussion on page 7 of this thread. So apparently the variant names that get used in the resulting JSON string are not the name fields of the cluster, but rather the names of the pieces of data inside the variant. This feels very counterintuitive to me, but in case someone is running into the same issue, at least one solution is to name the data used inside the variant (see image below).

Would it be possible to use the names of the fields in the cluster instead of the names inside the variant? That would feel more intuitive to me and apparently several others as well.

image.png.6d52040ffcbe017af007a31e237a4519.png     image.png.1f750f921e6592e1c71958898629ca0b.png

Posted
19 minutes ago, jmog said:

Can't find a way to edit my previous post, so continuing here. After posting, I found the related discussion on page 7 of this thread. So apparently the variant names that get used in the resulting JSON string are not the name fields of the cluster, but rather the names of the pieces of data inside the variant. This feels very counterintuitive to me, but in case someone is running into the same issue, at least one solution is to name the data used inside the variant (see image below).

Would it be possible to use the names of the fields in the cluster instead of the names inside the variant? That would feel more intuitive to me and apparently several others as well.

image.png.6d52040ffcbe017af007a31e237a4519.png     image.png.1f750f921e6592e1c71958898629ca0b.png

Nothing is impossible but often so painful that not doing it is almost in every case the better option.

The label of the data in the variant is the label of the data element that was used to create the variant. The variant has also a label but that is one level higher. You could of course modify JSON to Text, but that is a lot of work. And I think it is up to James if he feels like this would be a justified effort. Personally I absolutely would understand if he feels like "Why bother".

Join the conversation

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

Guest
Unfortunately, your content contains terms that we do not allow. Please edit your content to remove the highlighted words below.
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.

×
×
  • Create New...

Important Information

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