VRCJson.TryDeserializeFromJson may still incorrectly parse arrays when strings contain brackets
ureishi
Tested with VRCSDK 3.10.3.
I would like to report an issue with
VRCJson.TryDeserializeFromJson
.It appears that deserialization fails when a JSON array contains string values with bracket characters such as
{
, }
, [
, ]
, and the number of opening and closing brackets inside those strings does not match, even though the JSON itself is valid.The following are valid JSON arrays and should deserialize successfully:
["["]
["{"]
VRCJson.TryDeserializeFromJson
returns false
for these examples.There is also a case where malformed JSON arrays are incorrectly accepted as valid.
[ [ } ]
Example:
string json1 = @"[""[""]";
Debug.Log(VRCJson.TryDeserializeFromJson(json1, out var _1));
// expect: True
// actual: False
string json2 = "[[}]";
Debug.Log(VRCJson.TryDeserializeFromJson(json2, out var _2));
// expect: False
// actual: True
Log In