LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Retrieving Data from JSON

Solved!
Go to solution

Hi

I need to retrieve data from JSON using unflatten from JSON sub vi.

My JSON is {"LogMsg":[{"PE":128,"UID":"WISE-4012_00D0C9E2F3B5","TIM":"1573536496","Record":[[0, 0, 7, 10],[0, 0,11, 0]]}]}

I need the value 7 from it.

I want a method without using any addons

0 Kudos
Message 1 of 9
(2,770 Views)
Solution
Accepted by topic author tomp93

How about:regex.png

Certified LabVIEW Architect
Message 2 of 9
(2,755 Views)
Solution
Accepted by topic author tomp93

I'm no power user of JSON, but if you really want to use the unflatten from JSON, you can do it like this:

json sxtract.PNG

I tried using "path" down to "record" but that doesn't work, not sure why, or how that path should be constructed.

Certified LabVIEW Architect
Message 3 of 9
(2,733 Views)

Thanks ... 🙂

It Worked. Now Iwant solution to get that timestamp "1573536496" from that.

Could you please suggest similar for that also.

0 Kudos
Message 4 of 9
(2,729 Views)
Solution
Accepted by topic author tomp93

Here is another one if you really only want 7:

 
Message 5 of 9
(2,727 Views)

Thanks cordm, thats where I was failing. Of course it should be like that.

Certified LabVIEW Architect
0 Kudos
Message 6 of 9
(2,717 Views)

@tomp93 wrote:

Thanks ... 🙂

It Worked. Now Iwant solution to get that timestamp "1573536496" from that.

Could you please suggest similar for that also.


I suggest you go to https://regex101.com and test the regex for that by some trial end error. Thats what I always do.

Certified LabVIEW Architect
0 Kudos
Message 7 of 9
(2,714 Views)

@tomp93 wrote:

Thanks ... 🙂

It Worked. Now Iwant solution to get that timestamp "1573536496" from that.

Could you please suggest similar for that also.


What date should 1573536496 be? There are a few different standards...

 

Anyway, unbundle the string, and parse the string. It's not a JSON problem anymore.

0 Kudos
Message 8 of 9
(2,712 Views)

 

Thank you all for the solutions. All worked. 🙂

0 Kudos
Message 9 of 9
(2,678 Views)