LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Filter String / Return API

Solved!
Go to solution

Hello,

I got this return from an API GET call

{"records":[{"id":"recxfXKnsWbSIFm8k","createdTime":"2024-06-10T11:27:34.000Z","fields":{"Name":"BRBNUD385968 - 277"}},{"id":"recjsUHMUoXE4ZzQA","createdTime":"2024-06-10T11:47:03.000Z","fields":{"Name":"BRBNUD385968 - 510"}}]}

And I need to remove from the string, only "Name" and the corresponding value of it

The return of this API is dynamic, that is, they can have from 2 to infinite "Name" and I need all of them

Can you help me with this?

0 Kudos
Message 1 of 5
(546 Views)

Hi Leandro,

 


@leandrofeder wrote:

And I need to remove from the string, only "Name" and the corresponding value of it


Search the string for "Name":" (including quotation marks), then search for the next "/quotation mark and keep the substring before to get the Name value…

 


@leandrofeder wrote:

The return of this API is dynamic, that is, they can have from 2 to infinite "Name" and I need all of them


Use a loop to repeat the step above until there is no "Name" found anymore…

Best regards,
GerdW


using LV2016/2019/2021 on Win10/11+cRIO, TestStand2016/2019
0 Kudos
Message 2 of 5
(535 Views)

Hello,

 

If you are not against using regex, you can use this:

 

PinguX_0-1718022357751.png

 

Then just add a While Loop for searching all occurrences in the input string.

0 Kudos
Message 3 of 5
(534 Views)
Solution
Accepted by topic author leandrofeder

It is easy when you use JSONText, because it understands JSONPath notation.

Not sure if you really meant remove or rather extract, here is both:

snip.png

Message 4 of 5
(530 Views)

Thank you, work's well i need

0 Kudos
Message 5 of 5
(512 Views)