Deserialize JSON Data - Check Box Status

Hi, as a beginner I was trying use the following JSON data:
{
“formData”:{
“txn”:false,
“mu”:true,
“on”:true,
“wolf”:false,
},
“submit”:true}

How can I (after deserializing the JSON data) iterate through the data so that I can get each item with the label true? (in this case this should be stored in an array (“mu”,“on”)

I am struggling in finding the right commands.

Help is highly appreciated!

This data came out of the UiPath FormActivity Check Boxes. Where I output a variable called jsonString out of FormFieldsOutputData.

Hi

The following sample helps you.

Sample
Sample20241210-2.zip (3.1 KB)

Regards,

Hi, thanks for helping out!

Unfortunately this only gave me the output of one box. As I have 8 boxes with individual states, how can I create an array that only encorporates the checkboxes that are having the TRUE state?

Maybe I didnt mentioned that I’m using Select Boxes instead of Checkbox function.

Hi,

How about the following?

arrCheckboxName = {"checkboxA","checkboxB","checkboxC","checkboxD"}

Then

arrCheckboxName.Where(Function(s) jo(s).Value(Of Boolean)=True).ToArray

Sample
Sample20241210-2 (2).zip (3.4 KB)

Regards,

That really brings me close to a solution. What if I dont want the label to be added but the value instead?


Thanks for your support! :smiley:

Hi,

All right, it seems you use SelectBoxes. Can you try the following sample?

jo("selectBoxes").Where(Function(x)  CBool(x) = true).Select(Function(x) CType(x,JProperty).Name).ToArray()

Sample
Sample20241210-2 (3).zip (3.5 KB)

Regards,

Thats the solution, thanks for your constant an timely support!

1 Like