Jump to content

[CR] JSON LabVIEW


Recommended Posts

Looks good to me.  Any other changes before I make a new VIPM package?

 

One thing that I haven't gotten round to yet. If you re operating on a large JSON stream, you cannot process any other JSON streams as it seems to beblocking. I think it just needs setting some of the subVIs to re-entrant, but like I said. I haven't gotten round to looking as yet.

Link to comment

Hello. For 2D Array of strings the VI: "Variant Decode" doesn't if the strings have different Sizes

 

I made some changes using the data string information : nnnnstrstrstr... (4 bytes with string size + the string itself). 

 
JSON 2D Array of Strings
Album: Code Examples
1 images
0 comments

 

 
Regards from Portugal.
Manuel Carvalho
 
Edited by mcarvalho
Link to comment

Hi guys

 

Thumbs up for the good work!

 

I am creating a generic variant based intra-process configuration handler, and are considering using this as one of the user-selectable underlying 'file abstraction layers'.

However - since I plan on using an intermediate variant collection between the user and the file layer, I will need to be able to set new values in the JSON value tree without overwriting all other values.

Currently I don't see any way of doing this (I don't see a "Set sub-Item by names" function)..

 

Is this left out deliberately, or have you guys just not gotten around to it yet?! (or am I missing a point as to why it isn't implemented?) :)

Link to comment

Hi again

 

Regarding the post above I took the liberty of adding the functionality to the project.

I have attached a zip file containing only the VI's I have added or changed (folder structure has been kept) - feel free to add it to the project if you want..

 

Changes:

 + Added VI's for updating an existing JSON Collection Object value - by Array of names

 + Added VI's for removing a JSON Collection Object - by Array of names

 * Changed polymorphic Set VI to include new features .. the 'Set Object' function has been made into a submenu..

 

Best Regards

Stinus

Changes to tcplomp-json-api-labview-0c0d17447fc4.zip

  • Like 1
Link to comment
Hi Manual,

 

thanks for the report, the last commit by James should be fixing this.

Shaun, I haven't seen this, by using a quite large JSON set, and parsing it twice in parallel, both methods can the same time.

 

Regards,

 

Ton

 

It seems to be blocking with arrays.

 

Here's an example to demonstrate. The text file is made up of giant arrays so it makes it much more obvious (takes about .4 mins to execute)

 

I'll take a closer look on Sunday. A bit strapped for time at the moment.

Hi again

 

Regarding the post above I took the liberty of adding the functionality to the project.

I have attached a zip file containing only the VI's I have added or changed (folder structure has been kept) - feel free to add it to the project if you want..

 

Changes:

 + Added VI's for updating an existing JSON Collection Object value - by Array of names

 + Added VI's for removing a JSON Collection Object - by Array of names

 * Changed polymorphic Set VI to include new features .. the 'Set Object' function has been made into a submenu..

 

Best Regards

Stinus

 

Sweet.

I'll take a gander later.

Link to comment

I went over the code by Stinus, and it looks good and valid.

 

One of the open points in the code is retrieving attributes of waveforms. My proposal is to return each attribute as it's raw JSON string (indicated by a .JSON extension):

post-2399-0-39922200-1374326883.png

Any other ideas?

 

Ton

 

Link to comment
Hi Manual,

 

thanks for the report, the last commit by James should be fixing this.

Shaun, I haven't seen this, by using a quite large JSON set, and parsing it twice in parallel, both methods can the same time.

 

Regards,

 

Ton

"Set From JSON String.vi", "Name.vi" and "First Char.vi" are not set to re-entrant.

Just downloaded the latest version and "Set From JSON String.vi" now seems to be reentrant which cures the blocking. The others are still not re-entrant though.

Link to comment
  • 4 months later...
  • 1 month later...

Thanks for the fix!  I wish I had found this thread earlier.  Can anybody create a new build and check it into bit bucket or is that reserved for people on the team?  Can somebody get the fix into a new build?



One thing that I haven't gotten round to yet. If you re operating on a large JSON stream, you cannot process any other JSON streams as it seems to beblocking. I think it just needs setting some of the subVIs to re-entrant, but like I said. I haven't gotten round to looking as yet.

 

 

I have seen similar behavior.  I can try to replicate it if anybody is interested. What I found was that if GetTypeInfo is being called by two separate application instances they block each other because it's non-reentrant.  I don't think we are going to find a work around for that.  This might be a unique situation that I found because of the multiple application instances aspect but I figured it was worth mentioning.

Link to comment
Thanks for the fix!  I wish I had found this thread earlier.  Can anybody create a new build and check it into bit bucket or is that reserved for people on the team?  Can somebody get the fix into a new build?

 

 

I have seen similar behavior.  I can try to replicate it if anybody is interested. What I found was that if GetTypeInfo is being called by two separate application instances they block each other because it's non-reentrant.  I don't think we are going to find a work around for that.  This might be a unique situation that I found because of the multiple application instances aspect but I figured it was worth mentioning.

The fix has already been pushed to bitbucket. The others will review it then, if it's acceptable, drjdpowell will fold in any other changes and build a VIP package for the CR (only he can update the CR).

Link to comment
  • 2 weeks later...

After doing some testing I found that JSON to Variant can't handle empty paths.  The problem is caused by the OpenG Scan Variant From String throwing error #1 because the string it is scanning is empty.  A simple fix would be to add an additional case structure to handle paths within JSON to Variant.  

Link to comment
After doing some testing I found that JSON to Variant can't handle empty paths.  The problem is caused by the OpenG Scan Variant From String throwing error #1 because the string it is scanning is empty.  A simple fix would be to add an additional case structure to handle paths within JSON to Variant.  

 

I think the OpenG Scan Variant From String is obsolete since JSON to Variant can handle all types now (apart from refnum and path-which are easily added). We should consider removing the OpenG Scan Variant From String completely. I would also suggest that for the unknown data type we output a string type and raise a warning  rather than an error..

Edited by ShaunR
Link to comment

I think the OpenG Scan Variant From String is obsolete since JSON to Variant can handle all types now (apart from refnum and path-which are easily added). We should consider removing the OpenG Scan Variant From String completely. I would also suggest that for the unknown data type we output a string type and raise a warning  rather than an error..

 

Sounds good to me.  I am new to BitBucket so excuse me if this sounds stupid but do I have to be part of the "Team" to download the source?  I have SourceTree installed but I think I am blocked from contributing.  

 

If I had access I would be glad to make these changes.

Link to comment

I just committed my code to BitBucket for handling paths and refnums.  Should the commit be showing up in BitBucket before it's reviewed?  This is my first BitBucket project and I am trying to make sure that I didn't screw up and step on anybodies toes.  Let me know...

Link to comment

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.