Json Parser Issue
tracked
Extrude Ragu
default
{
state_entry()
{
string json_array = llList2Json(JSON_ARRAY, ["\"", "]"]);
string json_object = llList2Json(JSON_OBJECT,[
"string", "Hello, world!",
"json_array", json_array,
"double quote", "\""
]);
llSay(0, json_object);
string extracted_string = llJsonGetValue(json_object, ["string"]);
string extracted_array = llJsonGetValue(json_object, ["json_array"]);
llSay(0, "extracted_string:" + extracted_string); // Says "Hello, world!"
llSay(0, "extracted_array:" + extracted_array); // Empty string?
}
}
There seems to be an issue with the way llJsonGetValue extracts json arrays.
This minimal repro script gives an empty string for the extracted array, instead of the given array.
Note that the created json object seems fine, it just can't extract from it.
Log In
Activity Feed
Sort by
Maestro Linden
tracked
Maestro Linden
I can reproduce this issue in server 2024-04-13.8669470296 using the provided LSL script. While the
json_object
string is properly built, I also see that this particular array can't be extracted from it.The parsing issue seems to be triggered by the
"]"
element in json_array
. If I change the value to something other character (like "A") then the array can be properly extracted.Otoa Kiyori
When I try to use llJsonGetValue() on a string that contains UTF-8 characters, it seems to return weird square sometimes also. I am guessing this is related to the known spec of this function related to "avoid using syntax characters" I am also guessing the string is expected to only have only part of first 128 characters in ASCII code.
Signal Linden
under review