Porter Posted July 9, 2020 Report Posted July 9, 2020 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. Quote
drjdpowell Posted September 23, 2020 Author Report Posted September 23, 2020 On 7/9/2020 at 4:39 AM, Porter said: Bug? JSONText doesn't apply input default values to missing cluster items of array elements. 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: Expand 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: 1 Quote
Thaddaeus Yale Posted September 29, 2020 Report Posted September 29, 2020 Will this library support the new LabView Map Collection type? Quote
drjdpowell Posted September 30, 2020 Author Report Posted September 30, 2020 On 9/29/2020 at 9:38 PM, Thaddaeus Yale said: Will this library support the new LabView Map Collection type? Expand No, unfortunately, as it is written in LabVIEW 2017, which does not have that type. Quote
Jordan Kuehn Posted October 29, 2020 Report Posted October 29, 2020 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? Quote
JKSH Posted October 29, 2020 Report Posted October 29, 2020 On 10/29/2020 at 3:25 PM, 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. Expand 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. Quote
Jordan Kuehn Posted October 29, 2020 Report Posted October 29, 2020 On 10/29/2020 at 7:44 PM, 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. Expand 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. Quote
drjdpowell Posted October 29, 2020 Author Report Posted October 29, 2020 On 10/29/2020 at 8:03 PM, 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. Expand 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. Quote
Jordan Kuehn Posted October 29, 2020 Report Posted October 29, 2020 On 10/29/2020 at 9:40 PM, 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. Expand I'm not surprised by this, but thank you for weighing in. Maybe when NXG reaches CG parity in 2050. 1 Quote
RedBeard Posted November 18, 2020 Report Posted November 18, 2020 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 Issue JSON Text to Array.viFetching info... Quote
drjdpowell Posted November 18, 2020 Author Report Posted November 18, 2020 On 11/18/2020 at 12:35 PM, RedBeard said: i found an issue converting a array of clusters from text to data. Expand https://bitbucket.org/drjdpowell/jsontext/issues/68/report-issue-converting-a-array-of Quote
Jordan Kuehn Posted January 28, 2021 Report Posted January 28, 2021 I skimmed through the comments and I hope this wasn't addressed. If so, my apologies. Is there a way to limit the number of decimal places stored in a double numeric? Also, is there a way to generate a JSON schema based on a LabVIEW data structure? Thank you for this excellent toolkit. Quote
drjdpowell Posted January 28, 2021 Author Report Posted January 28, 2021 On 1/28/2021 at 1:53 AM, Jordan Kuehn said: Is there a way to limit the number of decimal places stored in a double numeric? Expand No. Only by custom formatting the numbers into JSON yourself. I often use single numerics, as 7 decimal places is more reasonable looking. Quote
drjdpowell Posted January 28, 2021 Author Report Posted January 28, 2021 On 1/28/2021 at 1:53 AM, Jordan Kuehn said: Also, is there a way to generate a JSON schema based on a LabVIEW data structure? Expand Not sure I understand the question. Can you rephrase it? Quote
Jordan Kuehn Posted January 28, 2021 Report Posted January 28, 2021 On 1/28/2021 at 8:34 AM, drjdpowell said: Not sure I understand the question. Can you rephrase it? Expand I have a request from non-LV programmers who are using the JSON output I am providing them to provide the schema so that they can ensure they are accurately parsing the data structure. I have used a tool similar to this: https://www.liquid-technologies.com/online-json-to-schema-converter to generate it, but it is imprecise. I’d prefer to just give them the typedef file, but they have no idea what to do with that. Quote
Jordan Kuehn Posted January 28, 2021 Report Posted January 28, 2021 On 1/28/2021 at 8:33 AM, drjdpowell said: No. Only by custom formatting the numbers into JSON yourself. I often use single numerics, as 7 decimal places is more reasonable looking. Expand Understood, thanks! Quote
drjdpowell Posted January 28, 2021 Author Report Posted January 28, 2021 On 1/28/2021 at 8:50 AM, Jordan Kuehn said: I have a request from non-LV programmers who are using the JSON output I am providing them to provide the schema so that they can ensure they are accurately parsing the data structure. I have used a tool similar to this: https://www.liquid-technologies.com/online-json-to-schema-converter to generate it, but it is imprecise. I’d prefer to just give them the typedef file, but they have no idea what to do with that. Expand Ah, you mean this then: http://json-schema.org/understanding-json-schema/, and you want a function that converts a LabVIEW Cluster/Array to a basic JSON Scheme. That does not exist in JSONtext but could at some point. 1 Quote
TiborK Posted February 4, 2021 Report Posted February 4, 2021 Hi, is there a chance to release build version for LabVIEW 2015? In VIPM is allowed just >=2017. Thanks a lot. Quote
drjdpowell Posted February 4, 2021 Author Report Posted February 4, 2021 On 2/4/2021 at 7:17 AM, TiborK said: Hi, is there a chance to release build version for LabVIEW 2015? In VIPM is allowed just >=2017. Expand I'm afraid it uses Malleable VIs that were introduced in 2017, meaning it can't, as a whole at least, be back ported. Quote
Antoine Chalons Posted February 4, 2021 Report Posted February 4, 2021 (edited) Would it be possible to add support for maps / sets - as if they were arrays - ? I can really remember if they were added in LV 17 or 18 or 19.... Edited February 4, 2021 by Antoine Chalons Quote
crossrulz Posted February 4, 2021 Report Posted February 4, 2021 On 2/4/2021 at 10:52 AM, Antoine Chalons said: Would it be possible to add support for maps / sets - as if they were arrays - ? I can really remember if they were added in LV 17 or 18 or 19.... Expand Sets and Maps were added in 2019. But just to throw a wrench into your dreams, you can get some interesting combinations when it comes to sets and maps. You could have a set of maps. You could have a map with a set for a key. I'm just saying, you would have to plan this out very carefully. Quote
Antoine Chalons Posted February 4, 2021 Report Posted February 4, 2021 On 2/4/2021 at 12:27 PM, crossrulz said: Sets and Maps were added in 2019. But just to throw a wrench into your dreams, you can get some interesting combinations when it comes to sets and maps. You could have a set of maps. You could have a map with a set for a key. I'm just saying, you would have to plan this out very carefully. Expand Very true!! I do use nested combinations of set and map - not hugely deep but it does turn out to be very useful. And yes it might not be trivial to handle ALL possible cases. But let's engineer ambitiously, no? Quote
drjdpowell Posted February 4, 2021 Author Report Posted February 4, 2021 Sets and Maps are 2019, so I'm not sure they can be supported till JSONtext is in 2019. Quote
sprezzaturon Posted March 17, 2021 Report Posted March 17, 2021 Is there any way to simply get the keys or have the json structure convert into a cluster? I've tried using the "find multiple items.vi", but nothing shows. No errors either. I've also tried using "Get all objects items.vi" but looks like I have to guess at the offset and do a recursive loop. Thank you, Ron Quote
drjdpowell Posted March 17, 2021 Author Report Posted March 17, 2021 Have you looked at the examples? Quote
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.