Jump to content

Shmee

Members
  • Posts

    2
  • Joined

  • Last visited

Everything posted by Shmee

  1. Hello Jim, Thank you for response and effort. I've actually tried before similar approach but eventually gave up because of another problem. Maybe you could help solving that. In order to plot on different graphs, I have to separate the output array into several arrays - separate array for every value. But as the JSONs on input differ from message to message, things are getting a bit more complicated because array size and positions of the values are constantly changing. The only solution I could think of is using index array function and some logic based on Item Names output from Get All Object Items VI to extract data from one combined array that we have in current VI. I guess I would have to copy that method for every value so it would be pretty nasty and I don't have a good feeling regarding optimization using method like that? Maybe there is a more elegant solution for that? In attachment, you have the VI in which I have simulated three different JSON messages I could expect on input, going into the code you have suggested. Would be grateful if you could take a look. Thanks in advance. JSON Test.vi
  2. Hello, I am having difficulties with extracting JSON messages and since this is my first time to deal with JSON extracting in LabVIEW, I am not sure whether it is possible to solve it and how. Now, JSON input is something like this: {"VALUE1":{"0":{"x":100,"y":0.2},"1":{"x":300,"y":0.4},"2":{"x":500,"y":0.6}},"VALUE2":{"0":{"x":1000,"y":0.200},"1":{"x":300,"y":0.4},"2":{"x":500,"y":0.6}},"VALUE2":{"0":{"x":10000,"y":0.2000},"1":{"x":3000,"y":0.04},"2":{"x":5000,"y":0.06}},"VALUE2":{"0":{"x":1000,"y":0.200},"1":{"x":300,"y":0.4},"2":{"x":500,"y":0.6}},"VALUE3":{"0":{"x":1000,"y":0.200},"1":{"x":300,"y":0.4},"2":{"x":500,"y":0.6}},"VALUE5":{"0":{"x":1000,"y":0.200},"1":{"x":300,"y":0.4},"2":{"x":500,"y":0.6}}} You can see that I can have mixed object items: one "value1", repeated (multiple) "value2", one "value3", missing "value4" and then "value5"... Any object item can be multiplied or missing in different messages I receive. My question is how to extract repeated object items and plot them on a XY graph? To be more precise, if I get no item in a message - I should keep the old values (not to have drop to zero on a graph), if I get one item, I should just plot it and if I get multiple items in a message, I should plot all of them on a graph. This is what I did so far. It plots and keeps old values if nothing received but I have problem extracting multiple values. I would appreciate any hint or help. Thanks in advance, Misa.
×
×
  • Create New...

Important Information

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