From Friday, April 19th (11:00 PM CDT) through Saturday, April 20th (2:00 PM CDT), 2024, ni.com will undergo system upgrades that may result in temporary service interruption.

We appreciate your patience as we improve our online experience.

LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Add object into JSON file

Solved!
Go to solution

Hello,

 

Maybe it looks like a silly question, but I have just started to work with JSON files (I have never worked with them before). I'm trying to add an object (I don't know if this is the correct term) into a JSON file already created, but the new object replaces all the others of the same item.

panel & diagram.png

0 Kudos
Message 1 of 3
(1,645 Views)
Solution
Accepted by topic author vicens

You could get the array elements and concatenate like this:

2020-09-23 11_45_22-Add data to JSON.vi Block Diagram _.png

 

Message 2 of 3
(1,611 Views)

Note: in the latest available versions of JSONtext, one can use [#] to indicate a point at the end of an array for insertion, so one can directly insert using the path "$.users[#]".

 

2021-02-24 15_47_49-Window.png

 

Message 3 of 3
(1,366 Views)