Thomas Pedot Posted September 18, 2019 Report Share Posted September 18, 2019 Hello, I m having difficulties with Lava JSON API lib. I'm not good at Labview but if you can help me. I don't see a documentation or a small exemple. My REST API return me this kind of string : [ { "id": "Cartographie", "records": [ "20190801-162634" ], "name": "Cartographie", "description": "", "lft": 1, "rght": 2, "tree_id": 3, "level": 0, "parent": null }, { "id": "Cyclage endurance", "records": [ "20190909-140001", "20190703-100000", "20190603-110704" ], "name": "Cyclage endurance", "description": "Some descriptions", "lft": 1, "rght": 2, "tree_id": 4, "level": 0, "parent": null } ] I need to make an array of ids or names. How would you do that easily ? Quote Link to comment
drjdpowell Posted September 18, 2019 Report Share Posted September 18, 2019 4 hours ago, Thomas Pedot said: How would you do that easily ? You certainly can do this with LAVA JSON, but I would suggest you use the JSONtext library instead, if possible: Quote Link to comment
Thomas Pedot Posted September 23, 2019 Author Report Share Posted September 23, 2019 (edited) Hello, I tried your solution but I have an empty Array of data. JSON vers array.vi Edited September 23, 2019 by Thomas Pedot Quote Link to comment
drjdpowell Posted September 23, 2019 Report Share Posted September 23, 2019 Your names are strings, not variants. Quote Link to comment
Thomas Pedot Posted September 23, 2019 Author Report Share Posted September 23, 2019 Ok. I'm not a LabView expert. I expected values in table Names, e.g. Cartographie instead of name (for exemple). At the end I want to make a drop down menu for the front end. Thanks ! Quote Link to comment
drjdpowell Posted September 23, 2019 Report Share Posted September 23, 2019 Oops, two things called "name". The "Names" output is an array of item names. Your item name is, confusingly, "name". "Cartographie" is one of your date values. It is a string, and I in my example provided a string as the data type. But you provided as data type an empty/void Variant, which will fail. Use a string like in my example. Quote Link to comment
Thomas Pedot Posted September 23, 2019 Author Report Share Posted September 23, 2019 Ow! Perfect ! I link automatically JSONText ! Thanks that's perfect Quote Link to comment
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.