Closed plmayer closed 6 years ago
You implicitly use ToString on your "cat" value. ToString on a JSONNode will return the json representation of the node. Since the node is a string node it returns the quoted value. If you want to access the string value, use the "Value" property.
foreach (JSONNode cat in o["categories"])
{
Debug.Log(cat.Value);
}
That makes sense. Thanks!
If you have a string array like this:
"categories": [ "A", "B" ]
which you read like this:
JSONArray arr = o["categories"].AsArray; foreach (JSONNode cat in arr) { Debug.Log(cat); }
You get "A", "B" -- not A, B -- i.e. the quotes are part of cat. AFAIK they shouldn't be, as the type of the array elements is string. Or am I missing something here?