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
(4,454 Views)
Solution
Accepted by topic author tomp93

How about:regex.png

Certified LabVIEW Architect
Message 2 of 9
(4,439 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
(4,417 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
(4,413 Views)
Solution
Accepted by topic author tomp93

Here is another one if you really only want 7:

 
Message 5 of 9
(4,411 Views)

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

Certified LabVIEW Architect
0 Kudos
Message 6 of 9
(4,401 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
(4,398 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
(4,396 Views)

 

Thank you all for the solutions. All worked. šŸ™‚

0 Kudos
Message 9 of 9
(4,362 Views)