Monte Goulding wrote:

try

    "colorwheel": [
                                {
                                   “name”: “Red”,
                                    “color”: “255,0,0"
                                },


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 supported on export.

Valid JSON going in:


{
        "settings": {
                "global": "",

                "modules":

                {
                        "colormeds": 
                                {"breathCount": "1",
                                "cycle": "1",
                                "currentLevel": "1",
                                "breathRate": "1"
                                }
                }
        }
}



gets written out as:  a single line

{"settings": {"global": "","modules": {"colormeds": {"1": {"breathCount": 
"1","cycle": "1","currentLevel": "1","breathRate": "1"}}}}}

AND

Square brace notation is not supported, but converted to explicit numeric keys
--not a big problem, but good to be aware that

this goes in:   

{
        "settings": {
                "global": "",

                "modules":

                {
                        "colormeds": 
                        [
                        {
                                "breathCount": "1",
                                "cycle": "1",
                                "currentLevel": "1",
                                "breathRate": "1"
                                }
                        ]
                }
        }
}

and comes out as

{"settings": {"global": "","modules": {"colormeds": {"1": {"breathCount": 
"1","cycle": "1","currentLevel": "1","breathRate": "1"}}}}}

which, formatted looks like:

{
        "settings": {
                "global": "",
                "modules": {
                        "colormeds": {
                                "1": {
                                        "breathCount": "1",
                                        "cycle": "1",
                                        "currentLevel": "1",
                                        "breathRate": "1"
                                }
                        }
                }
        }
}

Actually I find it easier to wrap my brain around the latter… though it would 
be nice if the output were formatted.  Does anyone have a JSON formatter 
function I can pass this thru before writing to disk?

BR
 

_______________________________________________
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

Reply via email to