How to count name in JSON object

HI, I want to count occurrence of a name in a json object and then proceed accordingly. For eg : If namevariable count is 1 we need to do something, if its more than 1 we need to throw BRE. Please advise.

Hi @Anived_Mishra

Have you tried with → JObject.Count

Have a look on the XAML file

JSonExtraction.xaml (10.2 KB)


1 Like

in general it is dependend to the JSON structure. Also we cannot derrive if name related to the Property name or to the value of a particular property.

Have also a look on the SelectTokens where we retrieve all descendants in a relative way

myJObject - outpur from Deserialize JSON

Maybe you can share the JSON or sample data with us, when more help is needed

thanks, please share the JSON in a way that we can refer to all details
e.g. as text file or serialized to string thanks

JProperty(1) { [Anived Mishra] } we are much interested of the property name where we would expect the name value

For an experiment (as we dont know the details) you can try

myJObject.Descendants().OfType(Of JProperty).Where(Function (x) x.Value.toString.Equals("Anived Mishra")).Count
1 Like

Thank you so much! It worked.

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