BC30456: "Count" Is not a member of JToken

Hi All,

this code was working well before in Windows Legacy, but when I upgraded to 2023.4.5 and windows i got this error.

Here’s the code

JsonObject(“DocumentTypes”).Count

Error Im getting is BC30456: Count is not a member of JToken.

Hi @sharon.palawandram

Once try this

JsonObject("DocumentTypes").Properties().Count()

or

DirectCast(JsonObject("DocumentTypes"), JObject).Count

Thank you for your quick reply

image

but DirectCast(JsonObject(“DocumentTypes”), JObject).Count seems to have sorted the issue.

1 Like

I am also getting errors for these, can I convert with same DirectoryCast?

new string(JsonObject(“DocumentTypes”)(CurrentItem-1)(“Fields”).Count - 1){}

@sharon.palawandram

Try this

New String(DirectCast(JsonObject("DocumentTypes")(CurrentItem-1)("Fields"), JArray).Count - 1) {}

1 Like

Thank you, this worked!

1 Like

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