Array editing or Validate JSON string?

J. Landman Gay jacque at hyperactivesw.com
Sun Nov 18 14:40:14 EST 2018


When I needed to check JSON validation, I put the JSONToArray function 
inside a "try" structure. The catch clause will trigger and tell you 
there's an error. It isn't too much different than what the editor does but 
It can give you a clue.

--
Jacqueline Landman Gay | jacque at hyperactivesw.com
HyperActive Software | http://www.hyperactivesw.com
On November 18, 2018 12:32:27 PM prothero--- via use-livecode 
<use-livecode at lists.runrev.com> wrote:

> Bob,
> Tnx for the info. However, isn’t it reasonable that the LC conversion 
> should respond with some indication that it can’t do the JSON to array 
> conversion, rather than throw a script error?
>
> Bill
>
> William Prothero
> http://es.earthednet.org
>
>> On Nov 18, 2018, at 6:18 AM, bob--- via use-livecode 
>> <use-livecode at lists.runrev.com> wrote:
>>
>> Livecode provides a text editor to, well, edit text. It does not understand 
>> the syntax/grammar of languages (Livecode, HTML, Javascript, JSON, YML, 
>> etc). What you need is an editor that “knows" JSON.
>>
>> Your best bet is to copy the text into Sublime, Visual Studio Code or Atom 
>> which do understand JSON’s syntax/grammar. There may be some configuration 
>> to the tool you will need to do but you will get indications from these 
>> editors when you have malformed JSON.
>>
>> - Bob Hall
>>
>>> On Nov 17, 2018, at 6:39 PM, William Prothero via use-livecode 
>>> <use-livecode at lists.runrev.com> wrote:
>>>
>>> What I would like to do is get a dialog that the JSON wasn’t formed 
>>> correctly. Of course, since I’m using it for my personal development of my 
>>> app, I can know that it failed if I don’t get the answer dialog I put in 
>>> after it. but, it seems a kludge. Shouldn’t there be some kind of an error 
>>> result if the JSON is ill-formed?
>>
>> _______________________________________________
>> use-livecode mailing list
>> use-livecode at 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 at lists.runrev.com
> Please visit this url to subscribe, unsubscribe and manage your 
> subscription preferences:
> http://lists.runrev.com/mailman/listinfo/use-livecode







More information about the use-livecode mailing list