How to handle Json value true in If condition

Hi all,

In a project I’m working on ppl enter the mailing address and can then tick a box if their current residential address is the same as their mailing address.

In the json file that i receive this box translates to a value which will be either true or false, depending on whether they ticked that box or not.

Now I need to use that in an If Condition.
I wrote it like this: currentResidentialAddress.Item(“sameAsMailingAddress”)=true
where currentResidentialAddress is a JObject
and sameAsMailingAddress is the value in the json file.

But now I’m getting an error saying I can’t use operator = for Jtoken or Boolean…

Any suggestions?



CurrentResidentialAddress is a child element in the entire JSON it seems @JCH, so , as your jObj is also CurrentResidentialAddress ,

Try this
CurrentResidentialAddress ("CurrentResidentialAddress ").Item(“sameAsMailingAddress”)

let me know if it helps . If not, please post the entire JSON :slight_smile:

1 Like

Assuming that currentResidentialAddress is a JToken that has been properly set, you should do currentResidentialAddress.Item("sameAsMailingAddress").Value(of Boolean) as your condition, the =true part is unnecessary.

Additionally it looks like there is a typo in the json pictured, it looks like “Mailing” is spelled as “Maling” so be careful with that.


thanks @HareeshMR and sorry for the partial information :frowning:
I’m a total newby, but if I’m understanding what you are saying, I already deserialized the json which is why I was able to use currentResidentialAddress.Item(“sameAsMailingAddress”) successfully. I think… :thinking:

Thank you @DanielMitchell that worked. I guess I don’t need the =true because that statement there would already be the =true condition right?

And thanks as well for catching that spelling mistake! I’ll get that corrected and will also double check everything else now!

1 Like


the possible options for that statement are:
true=true -> true
false=true -> false

As you can see either way the result is the same as the left value.

Hi @DanielMitchell, I have a follow up question on this project.

I have to enter the details from the json file into a website. I have to provide 5 years of residential history.

Every time I have a new address, I need to click NEW. That will then open up a new list of fields to fill in. I would then populate the address details from data in the next object. Hopefully I got the terminology right there…

So my steps would be:

  1. For each address in previousResidentialAddress, click new.
  2. Type street
  3. Type city
    etc, etc
  4. click save

How should I put that in the for each activity? street would be the item right, so I can’t do for each item. Not sure how to get started on that…

I really appreciate your help!

^ You said it yourself. Use a For Each with the collection being your group of previous addresses. Then each loop item is a complete address and you can enter its info. If you want to share your complete json I could mock something up real quick to simulate the logic.

Thanks @DanielMitchell. here is the json.
I realize I need to do a for each activity, but just not sure what the ForEach field should have. Would it still be item?

Should I be asking this a new a post btw?

A new post probably wouldn’t hurt. I’ll check out your json now.

This topic was automatically closed 3 days after the last reply. New replies are no longer allowed.