Mantis Bug Tracker

View Issue Details Jump to Notes ] Issue History ] Print ]
IDProjectCategoryView StatusDate SubmittedLast Update
0007984opensim[REGION] Script Functionspublic2016-08-03 08:122017-05-21 08:46
ReporterBlueWall 
Assigned ToBlueWall 
PrioritynormalSeverityminorReproducibilityalways
Statuspatch includedResolutionopen 
PlatformOSOS Version
Product Versionmaster (dev code) 
Target Version0.8.1-rc2Fixed in Version 
Summary0007984: llList2Json
DescriptionThe llList2Json function inserts delimiters ahead of quotations when inserting a json object or array in a list being prepared to create json objects with nested data. (see included script)


Comparison of output

OpenSim:
Json test with list_LSLConstantList: [22,19,5]
[07:43] Constant Test: Json test with list_LSLIntegerList: [22,19,5]
[07:43] Constant Test: Json test with list_LSLStringList: ["a","b","c"]
[07:43] Constant Test: Json test with list_LSLStringList: {"lsl_constant":"[22,19,5]","lsl_integer":"[22,19,5]","lsl_string":"[\"a\",\"b\",\"c\"]","lsl_constant_directory":"{\"CAMERA_FOCUS_LOCKED\":22,\"VEHICLE_ANGULAR_MOTOR_DIRECTION\":19,\"INVENTORY_CLOTHING\":5,\"TEXTURE_BLANK\":\"5748decc-f629-461c-9a36-a35a221fe21f\",\"PI\":3.14159274101257}"}

SecondLife:
"lsl_constant":[22,19,5],"lsl_integer":[22,19,5],"lsl_string":["a","b","c"],"lsl_constant_directory":{"CAMERA_FOCUS_LOCKED":22,"VEHICLE_ANGULAR_MOTOR_DIRECTION":19,"INVENTORY_CLOTHING":5,"TEXTURE_BLANK":"5748decc-f629-461c-9a36-a35a221fe21f","PI":3.141593}}
Steps To Reproducedefault
{
    state_entry()
    {
        llSay(0, "Script running");
    }
    
    touch_start(integer det)
    {
        list list_LSLConstantList = [
            CAMERA_FOCUS_LOCKED, // 22
            VEHICLE_ANGULAR_MOTOR_DIRECTION, // 19
            INVENTORY_CLOTHING // 5
        ];
        
        list list_LSLIntegerList = [
            22,
            19,
            5
        ];
        
        list list_LSLStringList = [
            "a",
            "b",
            "c"
        ];
        
        string sJsonArray;
        string sJsonObject;
        
        sJsonArray = llList2Json(JSON_ARRAY, list_LSLConstantList);
        llOwnerSay("Json test with list_LSLConstantList: "+sJsonArray);
        
        sJsonArray = llList2Json(JSON_ARRAY, list_LSLIntegerList);
        llOwnerSay("Json test with list_LSLIntegerList: "+sJsonArray);
        
        sJsonArray = llList2Json(JSON_ARRAY, list_LSLStringList);
        llOwnerSay("Json test with list_LSLStringList: "+sJsonArray);
        
        list list_LSLConstantDirectory = [
            "CAMERA_FOCUS_LOCKED", CAMERA_FOCUS_LOCKED,
            "VEHICLE_ANGULAR_MOTOR_DIRECTION", VEHICLE_ANGULAR_MOTOR_DIRECTION,
            "INVENTORY_CLOTHING", INVENTORY_CLOTHING,
            "TEXTURE_BLANK", TEXTURE_BLANK,
            "PI", PI
        ];
        
        list list_JsonObjectList = [
            "lsl_constant", llList2Json(JSON_ARRAY, list_LSLConstantList),
            "lsl_integer", llList2Json(JSON_ARRAY, list_LSLIntegerList),
            "lsl_string", llList2Json(JSON_ARRAY, list_LSLStringList),
            "lsl_constant_directory", llList2Json(JSON_OBJECT, list_LSLConstantDirectory)
        ];
        
        
        sJsonArray = llList2Json(JSON_OBJECT, list_JsonObjectList);
        llOwnerSay("Json test with list_LSLStringList: "+sJsonArray);
    }
}
TagsNo tags attached.
Git Revision or version number
Run Mode Grid (Multiple Regions per Sim)
Physics EngineBasicPhysics
Script Engine
EnvironmentMono / Linux64
Mono VersionOther
ViewerAlchemy/Firestorm
Attached Filespatch file icon 0001-Add-test-for-json-object-when-processing-strings-in-.patch [^] (1,260 bytes) 2016-08-03 08:15 [Show Content]

- Relationships
related to 0008172closedLotek llJsonGetValue on complex json results in empty list 

-  Notes
(0030977)
BlueWall (administrator)
2016-08-03 08:16

See attached
(0031891)
UbitUmarov (administrator)
2017-05-21 08:29

script above on current master

08:25] mantis7984: Json test with list_LSLConstantList: [22,19,5]
[08:25] mantis7984: Json test with list_LSLIntegerList: [22,19,5]
[08:25] mantis7984: Json test with list_LSLStringList: ["a","b","c"]
[08:25] mantis7984: Json test with list_LSLStringList: {"lsl_constant":[22,19,5],"lsl_integer":[22,19,5],"lsl_string":["a","b","c"],"lsl_constant_directory":{"CAMERA_FOCUS_LOCKED":22,"VEHICLE_ANGULAR_MOTOR_DIRECTION":19,"INVENTORY_CLOTHING":5,"TEXTURE_BLANK":"5748decc-f629-461c-9a36-a35a221fe21f","PI":3.141593}
(0031892)
UbitUmarov (administrator)
2017-05-21 08:35

sorry not using the patch bc it no longer applies and the issues where a lot more than just this
(0031893)
UbitUmarov (administrator)
2017-05-21 08:46

Cases I know that not encode as SL;

- char '/' is not escaped (as "\/"), seems that now is optional and lib LitJSON we use does not do it, and SL does.

- json = llJsonSetValue("[]",[JSON_APPEND], "\"test\""); returns ["\"test\""] and not ["test"]

- Issue History
Date Modified Username Field Change
2016-08-03 08:12 BlueWall New Issue
2016-08-03 08:12 BlueWall Status new => assigned
2016-08-03 08:12 BlueWall Assigned To => BlueWall
2016-08-03 08:15 BlueWall File Added: 0001-Add-test-for-json-object-when-processing-strings-in-.patch
2016-08-03 08:16 BlueWall Note Added: 0030977
2016-08-03 08:16 BlueWall Status assigned => patch included
2017-05-21 06:10 BlueWall Relationship added related to 0008172
2017-05-21 08:29 UbitUmarov Note Added: 0031891
2017-05-21 08:35 UbitUmarov Note Added: 0031892
2017-05-21 08:46 UbitUmarov Note Added: 0031893


Copyright © 2000 - 2012 MantisBT Group
Powered by Mantis Bugtracker