Re: Maintain Order in JSON Import

2016-09-16 Thread Sannyasin Brahmanathaswami
Never mind.. I found it on the forums Mark just pasted his script there… no "lib" as such. On 9/16/16, 6:11 PM, "use-livecode on behalf of Sannyasin Brahmanathaswami" wrote: Richard Gaskin" wrote: YAML was designed to provide similar serialization to/from plain text,

Re: Maintain Order in JSON Import

2016-09-16 Thread Sannyasin Brahmanathaswami
Richard Gaskin" wrote: YAML was designed to provide similar serialization to/from plain text, but optimized for human readability/writability. Mark Wieder has a nice pair of functions for using it in LC, converting to and from arrays. BR: where can I get these? _

Re: Maintain Order in JSON Import

2016-09-16 Thread pink
son EasyJSON (stable, but not updated in several years): https://github.com/luxlogica/easyjson -- View this message in context: http://runtime-revolution.278305.n4.nabble.com/Maintain-Order-in-JSON-Import-tp4708343p4708523.html Sent from the Revolution -

Re: Maintain Order in JSON Import

2016-09-16 Thread Monte Goulding
> On 15 Sep 2016, at 12:22 PM, Roger Eller wrote: > > Sweet! Can this external be used in a Windows standalone? It supports all of LiveCode’s platforms and is dual licensed for community users too. Cheers Monte ___ use-livecode mailing list use-li

Re: Maintain Order in JSON Import

2016-09-15 Thread Richard Gaskin
Sannyasin Brahmanathaswami wrote: > On 9/14/16, 11:28 AM, Richard Gaskin wrote: > > Do you need to round-trip? Where does the data come from, and > where is it going? > > If any part of that is LC on both ends you can save _much_ time > for that using an encoded array. > The use

Re: Maintain Order in JSON Import

2016-09-15 Thread J. Landman Gay
On 9/14/16 9:01 PM, Sannyasin Brahmanathaswami wrote: The only way to save an encoded array would be to insert is a a custom property in an LC stack and save to the writeable folder on mobile. Just for the record, the arrayEncode function writes the array to a binary file on disk, not to a sta

Re: Maintain Order in JSON Import

2016-09-14 Thread Roger Eller
Sweet! Can this external be used in a Windows standalone? ~Roger On Sep 14, 2016 10:17 PM, "Monte Goulding" wrote: > > > On 15 Sep 2016, at 12:13 PM, Sannyasin Brahmanathaswami < > bra...@hindu.org> wrote: > > > >"Actually if I just let the jsonExport and jsonImport do the work… > it's val

Re: Maintain Order in JSON Import

2016-09-14 Thread Trevor DeVore
On Wednesday, September 14, 2016, Monte Goulding wrote: > > > Ah, I haven’t used the LCB JSON library myself. Perhaps Peter will chime > in here. > > FYI mergJSON turns a sequentially indexed array 1..N <-> a JSON array [ ]. > I use mergJSON to export for this very reason. I import with the LCB J

Re: Maintain Order in JSON Import

2016-09-14 Thread Monte Goulding
> On 15 Sep 2016, at 12:13 PM, Sannyasin Brahmanathaswami > wrote: > >"Actually if I just let the jsonExport and jsonImport do the work… it's > valid json… except that what's on disk is all on a single line." > > Python to the rescue: this works as a text filter in BBEdit It’s probably

Re: Maintain Order in JSON Import

2016-09-14 Thread Sannyasin Brahmanathaswami
bra...@hindu.org> wrote: "Actually if I just let the jsonExport and jsonImport do the work… it's valid json… except that what's on disk is all on a single line." Python to the rescue: this works as a text filter in BBEdit save to: ~/Library/Application Support/BBEdit/Text Filters/ #!/usr

Re: Maintain Order in JSON Import

2016-09-14 Thread Sannyasin Brahmanathaswami
The use case is cross session data on mobile where we would like to be able to examine/change the "array" in a text editor. if the user shuts down the app, you must save the data somewhere, and reload to gUserSettings on start up. So, yes, agreed, there are many ways to accomplish this. The on

Re: Maintain Order in JSON Import

2016-09-14 Thread Monte Goulding
> On 15 Sep 2016, at 7:18 AM, Sannyasin Brahmanathaswami > wrote: > > FYI, further tests with jsonImport/Export round trips, reading and writing: > > jsonImport > jsonExport > > are > > a) not in the dictionary for > b) round trip does not support any formatting (no indentation or ver

Re: Maintain Order in JSON Import

2016-09-14 Thread Richard Gaskin
Sannyasin Brahmanathaswami wrote: > FYI, further tests with jsonImport/Export round trips, reading and writing: > > jsonImport > jsonExport > > are > > a) not in the dictionary for > b) round trip does not support any formatting (no indentation or > vertical white space) > c) square braces not

Re: Maintain Order in JSON Import

2016-09-14 Thread Sannyasin Brahmanathaswami
Monte Goulding wrote: try "colorwheel": [ { “name”: “Red”, “color”: “255,0,0" }, FYI, further tests with jsonImport/Export round trips, reading and writing:

Re: Maintain Order in JSON Import

2016-09-12 Thread Sannyasin Brahmanathaswami
OK… so long as we are using bracket form… someArray [ ] then we will get numeric, sortable keys… so than just go ahead and use standard JSON notation inside the array.. got it. tks On 9/12/16, 11:31 AM, "use-livecode on behalf of Monte Goulding" wrote: It is not hacky. It is the way y

Re: Maintain Order in JSON Import

2016-09-12 Thread Monte Goulding
> On 13 Sep 2016, at 7:23 AM, Sannyasin Brahmanathaswami > wrote: > > this seems "hacky" but can now order the keys because they default to numeric > index It is not hacky. It is the way you represent sequences in JSON. The hacky part is the pipe delimiter. Try: "colorwheel": [

Maintain Order in JSON Import

2016-09-12 Thread Sannyasin Brahmanathaswami
If you import JSON like this: { "colormeds": { "progress": { "level": "1", "cycle": "1" }, "colorwheel": { "Red": "255,0,0",