How to validate JSON keys before getting value based on key

I have json and there are many keys and values but not fixed before getting value using key i have to check that is this key contain in json or not?

1 Like

JsonObject . has("key") method is used to find keys in JsonObject .

But there is not any method “has()” in JsonObject

you can check with this method of json object that is jsonvariable of jobject like

jsonvariable.ContainsKey(propertyname as string)

this gives you boolean whether it has the key or not

hope this would help you


hi can you give an elaborated example of this?
i’m facing the same problem. i need to check whether myjsonobject variable is empty or not.
i’m having difficulties with solving this as i am just a novice.

really its working for me …thanks

1 Like

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