Rhiannon Arkin Posted June 23, 2017 Share Posted June 23, 2017 So what IS the kick about json vs lists? Rhia Link to comment Share on other sites More sharing options...
mikka Luik Posted June 23, 2017 Share Posted June 23, 2017 The fact that if you can't handle lists within LSL then JSON is erm pointless? Also not sure what 'kick' means mate. Link to comment Share on other sites More sharing options...
Rhiannon Arkin Posted June 24, 2017 Author Share Posted June 24, 2017 well sorry too sloppy language. I meant, what is the advantage of using json here in sl. what does json provide that lists wouldn't. ? Link to comment Share on other sites More sharing options...
Berksey Posted June 24, 2017 Share Posted June 24, 2017 I honestly have no idea; I fiddled with it for web design for a bit, but I have no inkling of how it'd be used in SL... Thanks for giving me something to Google today~! Link to comment Share on other sites More sharing options...
Xiija Posted June 24, 2017 Share Posted June 24, 2017 (edited) json is mebbe a little easier than manipulating a lot of lists and list items? you can do something like.... string Stations = llList2Json( JSON_OBJECT, [] ); name = "jazz" url = "http://some.jazz.stream"; if (llJsonGetValue (Stations, [name] ) == JSON_INVALID) { Stations = llJsonSetValue (Stations, [name, "URL"], url); } and then get the info from the exact location by name, (if your listen event gets the string message "jazz") TuneIn = llJsonGetValue (Stations, [Msg, "URL"]) ; llSetParcelMusicURL(TuneIn); you can do most of the json stuff with strided lists, so, what ever you like http://wiki.secondlife.com/wiki/Json_usage_in_LSL http://wiki.secondlife.com/wiki/Talk:Json_usage_in_LSL http://wiki.secondlife.com/wiki/User:Vegas_Silverweb/LSL_to_JSON Edited June 24, 2017 by Xiija 1 Link to comment Share on other sites More sharing options...
Berksey Posted June 24, 2017 Share Posted June 24, 2017 That's actually... pretty cool. Link to comment Share on other sites More sharing options...
Nova Convair Posted June 24, 2017 Share Posted June 24, 2017 Json allows to store data in a record/array structure. If you need that or want to export data in that format - use json. I personally didn't have any use for it. Lists are good for my stuff. If I ever have a complicated multi dimensional data structure I will consider to use json for that but for the usual simple stuff I don't need it. 1 Link to comment Share on other sites More sharing options...
Rhiannon Arkin Posted June 26, 2017 Author Share Posted June 26, 2017 thanks for the infos. i guess json is another tool in the toolbox. i was so curious because often,when i post here with my scripting troubles, json comes up as "or you try it with json". R. Link to comment Share on other sites More sharing options...
Love Zhaoying Posted June 27, 2017 Share Posted June 27, 2017 On 6/24/2017 at 6:04 AM, Nova Convair said: Json allows to store data in a record/array structure. If you need that or want to export data in that format - use json. I personally didn't have any use for it. Lists are good for my stuff. If I ever have a complicated multi dimensional data structure I will consider to use json for that but for the usual simple stuff I don't need it. Agree, I've been avoiding using JSON all these years, but finally have a project with a complex enough data structure requirement to justify it. Link to comment Share on other sites More sharing options...
Dora Gustafson Posted July 3, 2017 Share Posted July 3, 2017 JSON in LSL is slow compared to a similar task solved the traditional way with lists Avoid using JSON it in time critical applications Use JSON for complex list arrays when the execution time is not critical 3 Link to comment Share on other sites More sharing options...
SnowFlowerSittingWolf Posted February 27, 2019 Share Posted February 27, 2019 Some things bothered me about this thread, I'll clear them up here about json: 1. Json is not useless, its basically the language nearly every RESTFul API and data-driven HTTP-standardized and secure HTTPS API talks in on the internet (XML being another language API talks in, but thats another story). sURLs talk in json when sent a GET request, as an example. Its how data is relayed to/from second life database servers, and external sources, such as a product developer's website for registration information and personalized owner settings stored in an object. 2. Json is not time-critical. It was designed as a web communication protocol to pass data to and from a web-server, and should be used that way. It is similar in concept to what HTML is, and what XML is. If you find yourself using json objects without making http/https requests, you probably should be looking at some other way to store your objects. 3. Json data should be treated with a hard upper limit of 4096 UTF-8 byes in core LSL and 16384 UTF-8 bytes in Mono as part of the request body limit of the LSL web toolkit. LSL is not designed nor optimized to handle json structures larger than this. Most API will never send/accept much more than this if properly designed, anyway, with Second Life in mind. 4. Json serialization/deserialization inclusion in LSL is an essential part of the Second Life LSL web toolkit, and makes all of our lives much easier when dealing with CRUD-model based API and database systems on and off second life. If you've ever dealt with a notecard memory database, you'll be pleased to know you can toss that code out - LSL is Json and RESTFul web HTTP request friendly. 5. Json should never be used as a permanent method of documentstore (datastore). Its simply a communication protocol designed to send objects to/from a more permanent document store, such as an api which stores/retrieves information from a mysql database, sqllite implementation, or nosql implementation that can reply to queries efficiently and process data quickly. It is not optimized for speed, but is for portability. For more information, please visit these help topics: What is Json? (web protocol) https://www.w3schools.com/whatis/whatis_json.asp Making HTTP/Secure HTTPS put/get requests with LSL http://wiki.secondlife.com/wiki/LlHTTPRequest Serializing/Deserializing request bodies with LSL - Json structure to native LSL objects and back: http://wiki.secondlife.com/wiki/Json_usage_in_LSL 2 Link to comment Share on other sites More sharing options...
steph Arnott Posted February 27, 2019 Share Posted February 27, 2019 On 6/23/2017 at 10:21 PM, Rhiannon Arkin said: So what IS the kick about json vs lists? Rhia JSON is an array a list is not. Link to comment Share on other sites More sharing options...
steph Arnott Posted February 27, 2019 Share Posted February 27, 2019 On 7/3/2017 at 12:51 PM, Dora Gustafson said: JSON in LSL is slow compared to a similar task solved the traditional way with lists Avoid using JSON it in time critical applications Use JSON for complex list arrays when the execution time is not critical No, a list and a JSON are two different beasts. You use one or the other to siut its purpose. Link to comment Share on other sites More sharing options...
Kyrah Abattoir Posted March 1, 2019 Share Posted March 1, 2019 I see a few interesting possibilities with Json Protocols: Adding extra data/unofficial extensions/phasing out legacy data in a protocol without any risks of parsing failure. Serialization: An object might pass to another object data that it will "need later" (when it is re-rezzed for instance is rezzed for example), and json is a good way to store that data. Data hiearchy: If for some reason you need something that behaves like a filesystem tree. Time will tell if the memory usage for storage/runtime turns out to be smaller than manipulating lists. I certainly like not having to deal with list offsets at the very least. Link to comment Share on other sites More sharing options...
Wulfie Reanimator Posted March 1, 2019 Share Posted March 1, 2019 (edited) LSL doesn't support lists-within-lists, so I like the idea of using JSON for that. What I've actually used it for is a menu-system. I allow users to write their desired menu layout into a notecard (not in pure JSON but something simpler), and then I parse it into JSON. Though, even the pure-JSON format would be pretty simple for menu-layouts. (Some superfluous brackets omitted) "main menu": { "menu a": [ "button 1", "button 2", "button 3" ], "menu b": [ "button 1", "button 2", "button 3", "button 4", "button 5", {"submenu 1":[ "button 1", "button 2", "button 3" ]} ], "menu c": [ "button 1", "button 2", "button 3", "button 4" ] } Edited March 1, 2019 by Wulfie Reanimator Link to comment Share on other sites More sharing options...
Recommended Posts
Please take a moment to consider if this thread is worth bumping.
Please sign in to comment
You will be able to leave a comment after signing in
Sign In Now