Andre, I'm using JSONToArray and ArrayToJSON for round trip with no problems. I'm storing an LC config array in a JSON text file, then later read the file back into an LC array. The only criticism I have is the formatting of the JSON in the text file could be better for manual changes with a text editor. Other than that it faithfully saves/recreates the LC array.
Ralph DiMola IT Director Evergreen Information Services rdim...@evergreeninfo.net -----Original Message----- From: use-livecode [mailto:use-livecode-boun...@lists.runrev.com] On Behalf Of Andre Garzia via use-livecode Sent: Monday, April 30, 2018 5:30 PM To: How to use LiveCode Cc: Andre Garzia Subject: LC Web integration is not good enough Hi Friends, This is a bit of a rant because I can't believe no one stopped by these kind of problems before. First of all, the JS Handlers for a browser widget are one way only. There is no way to call a LiveCode function from JS and actually see a response. You need to code two JS functions, one for calling LC and another for receiving the LC response in an analog (even worse) to the old callback hell of JS from early 2000. I find this quite unacceptable, it makes impossible to make multiple calls to LC to retrieve values without devolving into a spiral of callbacks. Besides the only way to execute JS code from LC is to use the do statement, which works with strings making it hard to assemble values compatible with JS. You need to go like building SQL statements in 1990s by concatenating a JS to be executed which is not only error prone, it is error certain. It will fail if you are building something really complext because.... Because LC jsonExport routines are broken, for they will export an array as an object, which makes no sense at all. For example, if you have an array like: t[1]["name"] = "andre" t[2]["name"] = "cleo" jsonExport will output: {"1": {"name": "andre"},"2": {"name": "cleo"}} instead of the correct: [{"name": "andre"}, {"name": "cleo"}] If you pick an array, pass through that jsonExport routine, assemble a correct JS string, send it to the web widget and the JS on the other side is expecting an array, it will fail because that is an object. So, in summary: * We have subpar integration that relies on callback hell * The json routines don't work * The integration to execute JS from LC relies on error-prone hand assembled strings The worst thing for me is the JSON library exporting objects. How did this didn't affected people on this list on the past is a bit beyond me. I am doing a simple round-trip execution of LC + JS here and it is taking me hours because I need to fight the current buggy feature implementations instead of focusing on my own business logic. -- http://www.andregarzia.com -- All We Do Is Code. http://fon.nu -- minimalist url shortening service. _______________________________________________ use-livecode mailing list use-livecode@lists.runrev.com Please visit this url to subscribe, unsubscribe and manage your subscription preferences: http://lists.runrev.com/mailman/listinfo/use-livecode _______________________________________________ use-livecode mailing list use-livecode@lists.runrev.com Please visit this url to subscribe, unsubscribe and manage your subscription preferences: http://lists.runrev.com/mailman/listinfo/use-livecode