Re: Array editing or Validate JSON string?

2018-11-19 Thread Mark Talluto via use-livecode
I always appreciate error reporting. I ran into the same problem. Sometimes you 
can see the error easily enough. But, in complex arrays, it is harder to see 
the error when looking at JSON. For this reason, I find dropping it into a 
validator to be useful. They can point you in the right direction to fix the 
JSON.

But, if you are trying to pick up on this programmatically in an app, the best 
you can do is check for success or failure by looking for data in the array. If 
it is not there, an error took place.


Best regards,

Mark Talluto
livecloud.io 
nursenotes.net 
canelasoftware.com 




> On Nov 17, 2018, at 3:39 PM, William Prothero via use-livecode 
>  wrote:
> 
> Folks:
> I guess I could have been more clear. I am editing the JSON directly in a 
> text field. If I make a mistake, then use JSONToArray, the program just fails 
> silently. 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?
> Best,
> Bill
> 
>> On Nov 16, 2018, at 1:57 PM, Mark Talluto via use-livecode 
>>  wrote:
>> 
>> Hi Bill,
>> 
>> My favorite JSON validator is:  https://jsonformatter.curiousconcept.com 
>> 
>> 
>> 
>> Best regards,
>> 
>> Mark Talluto
>> livecloud.io 
>> nursenotes.net 
>> canelasoftware.com 
>> 
>> 
>> 
>> 
>>> On Nov 15, 2018, at 3:09 PM, William Prothero via use-livecode 
>>>  wrote:
>>> 
>>> Hi, I’m editing a json string (for development uses) and wonder if there is 
>>> an easy way to validate whether the string is a valid JSON string. 
>>> 
>>> Or, perhaps there is an easier way to display and edit a pretty simple 
>>> array.
>>> 
>>> Suggestions would be helpful. Currently, I convert the array to JSON, put 
>>> it in a text field, then edit the text field. It would be convenient if it 
>>> could trap editing errors I might make. The simple way seems to just throw 
>>> an error and stop execution of the script.
>>> 
>>> Best,
>>> Bill
>>> 
>>> William A. Prothero
>>> http://earthlearningsolutions.org
>>> 
>>> ___
>>> 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
> 
> 
> ___
> 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

Re: Array editing or Validate JSON string?

2018-11-18 Thread prothero--- via use-livecode
Jacqueline,
Thanks. Makes sense. I’ll do that.
Bill

William Prothero
http://es.earthednet.org

> On Nov 18, 2018, at 11:40 AM, J. Landman Gay via use-livecode 
>  wrote:
> 
> 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 | jac...@hyperactivesw.com
> HyperActive Software | http://www.hyperactivesw.com
>> On November 18, 2018 12:32:27 PM prothero--- via use-livecode 
>>  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 
>>>  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 
  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@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
> 
> 
> 
> 
> ___
> 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

Re: Array editing or Validate JSON string?

2018-11-18 Thread J. Landman Gay via use-livecode
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 | jac...@hyperactivesw.com
HyperActive Software | http://www.hyperactivesw.com
On November 18, 2018 12:32:27 PM prothero--- via use-livecode 
 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 
 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 
 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@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





___
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

Re: Array editing or Validate JSON string?

2018-11-18 Thread prothero--- via use-livecode
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 
>  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 
>>  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@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

Re: Array editing or Validate JSON string?

2018-11-18 Thread bob--- via use-livecode
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 
>  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@lists.runrev.com
Please visit this url to subscribe, unsubscribe and manage your subscription 
preferences:
http://lists.runrev.com/mailman/listinfo/use-livecode

Re: Array editing or Validate JSON string?

2018-11-17 Thread William Prothero via use-livecode
Folks:
I guess I could have been more clear. I am editing the JSON directly in a text 
field. If I make a mistake, then use JSONToArray, the program just fails 
silently. 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?
Best,
Bill

> On Nov 16, 2018, at 1:57 PM, Mark Talluto via use-livecode 
>  wrote:
> 
> Hi Bill,
> 
> My favorite JSON validator is:  https://jsonformatter.curiousconcept.com 
> 
> 
> 
> Best regards,
> 
> Mark Talluto
> livecloud.io 
> nursenotes.net 
> canelasoftware.com 
> 
> 
> 
> 
>> On Nov 15, 2018, at 3:09 PM, William Prothero via use-livecode 
>>  wrote:
>> 
>> Hi, I’m editing a json string (for development uses) and wonder if there is 
>> an easy way to validate whether the string is a valid JSON string. 
>> 
>> Or, perhaps there is an easier way to display and edit a pretty simple array.
>> 
>> Suggestions would be helpful. Currently, I convert the array to JSON, put it 
>> in a text field, then edit the text field. It would be convenient if it 
>> could trap editing errors I might make. The simple way seems to just throw 
>> an error and stop execution of the script.
>> 
>> Best,
>> Bill
>> 
>> William A. Prothero
>> http://earthlearningsolutions.org
>> 
>> ___
>> 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


___
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

Re: Array editing or Validate JSON string?

2018-11-16 Thread Mark Talluto via use-livecode
Hi Bill,

My favorite JSON validator is:  https://jsonformatter.curiousconcept.com 



Best regards,

Mark Talluto
livecloud.io 
nursenotes.net 
canelasoftware.com 




> On Nov 15, 2018, at 3:09 PM, William Prothero via use-livecode 
>  wrote:
> 
> Hi, I’m editing a json string (for development uses) and wonder if there is 
> an easy way to validate whether the string is a valid JSON string. 
> 
> Or, perhaps there is an easier way to display and edit a pretty simple array.
> 
> Suggestions would be helpful. Currently, I convert the array to JSON, put it 
> in a text field, then edit the text field. It would be convenient if it could 
> trap editing errors I might make. The simple way seems to just throw an error 
> and stop execution of the script.
> 
> Best,
> Bill
> 
> William A. Prothero
> http://earthlearningsolutions.org
> 
> ___
> 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

Re: Array editing or Validate JSON string?

2018-11-16 Thread JJS via use-livecode

https://jsonlint.com/


not there are a few forms to write JSON


Op 16-11-2018 om 02:55 schreef William Prothero via use-livecode:

Thanks, Terry:
I’ll give it a whack.
Bill


On Nov 15, 2018, at 5:19 PM, Terry Judd via use-livecode 
 wrote:

Hi Bill - I convert the JSON (jsonImport) to an array then use a treeview 
widget to display it. I then use an actionDoubleClick handler in the widget 
script to grab the appropriate array element and display it in an ask dialog. 
The value goes back into the array and I export the array back to JSON 
(jsonExport). Works well as long as the JSON elements don't contain large 
amounts of text - in which case you might need a custom dialog for displaying 
and editing the contents.

Terry...

On 16/11/2018 10:10 am, "use-livecode on behalf of William Prothero via 
use-livecode"  wrote:

Hi, I’m editing a json string (for development uses) and wonder if there is 
an easy way to validate whether the string is a valid JSON string.

Or, perhaps there is an easier way to display and edit a pretty simple 
array.

Suggestions would be helpful. Currently, I convert the array to JSON, put 
it in a text field, then edit the text field. It would be convenient if it 
could trap editing errors I might make. The simple way seems to just throw an 
error and stop execution of the script.

Best,
Bill

William A. Prothero
http://earthlearningsolutions.org

___
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


___
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

Re: Array editing or Validate JSON string?

2018-11-15 Thread William Prothero via use-livecode
Thanks, Terry:
I’ll give it a whack.
Bill

> On Nov 15, 2018, at 5:19 PM, Terry Judd via use-livecode 
>  wrote:
> 
> Hi Bill - I convert the JSON (jsonImport) to an array then use a treeview 
> widget to display it. I then use an actionDoubleClick handler in the widget 
> script to grab the appropriate array element and display it in an ask dialog. 
> The value goes back into the array and I export the array back to JSON 
> (jsonExport). Works well as long as the JSON elements don't contain large 
> amounts of text - in which case you might need a custom dialog for displaying 
> and editing the contents.
> 
> Terry...
> 
> On 16/11/2018 10:10 am, "use-livecode on behalf of William Prothero via 
> use-livecode"  use-livecode@lists.runrev.com> wrote:
> 
>Hi, I’m editing a json string (for development uses) and wonder if there 
> is an easy way to validate whether the string is a valid JSON string. 
> 
>Or, perhaps there is an easier way to display and edit a pretty simple 
> array.
> 
>Suggestions would be helpful. Currently, I convert the array to JSON, put 
> it in a text field, then edit the text field. It would be convenient if it 
> could trap editing errors I might make. The simple way seems to just throw an 
> error and stop execution of the script.
> 
>Best,
>Bill
> 
>William A. Prothero
>http://earthlearningsolutions.org
> 
>___
>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


___
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

Re: Array editing or Validate JSON string?

2018-11-15 Thread Terry Judd via use-livecode
Hi Bill - I convert the JSON (jsonImport) to an array then use a treeview 
widget to display it. I then use an actionDoubleClick handler in the widget 
script to grab the appropriate array element and display it in an ask dialog. 
The value goes back into the array and I export the array back to JSON 
(jsonExport). Works well as long as the JSON elements don't contain large 
amounts of text - in which case you might need a custom dialog for displaying 
and editing the contents.

Terry...

On 16/11/2018 10:10 am, "use-livecode on behalf of William Prothero via 
use-livecode"  wrote:

Hi, I’m editing a json string (for development uses) and wonder if there is 
an easy way to validate whether the string is a valid JSON string. 

Or, perhaps there is an easier way to display and edit a pretty simple 
array.

Suggestions would be helpful. Currently, I convert the array to JSON, put 
it in a text field, then edit the text field. It would be convenient if it 
could trap editing errors I might make. The simple way seems to just throw an 
error and stop execution of the script.

Best,
Bill

William A. Prothero
http://earthlearningsolutions.org

___
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