First time here? Check out the FAQ!
x

JSON: Why is "flatAssociations" an array instead of an object?

0 votes
332 views

Or in Python parlance, a list instead of a dictionary?

Looking at the "flatAssociatons" key, I see what appear to be key-value pairs, except that they are enclosed in square brackets [] rather than curly brackets {} and are separated by a comma rather than a colon. For example:

"lookOrNil": {
    "creationClass": "KymaLook",
    "database": {
        "creationClass": "FastIdentityDictionary",
        "flatAssociations":
[
            "vcsButtonDownColor",
            {
                "blue": 0.500061,
                "creationClass": "ColorValue",
                "green": 1.0,
                "red": 0.0
            },
            "vcsButtonUpColor"
,
            {
                "blue": 0.0,
                "creationClass": "ColorValue",
                "green": 0.0,
                "red": 1.0
            }
       
]
    },
    "nameOrNil": null,
    "superLook": {
        "creationClass": "KymaLook",
        "nameOrNil": "Waldo"
    }
},

I would have expected the middle of that to be:

"flatAssociations": {
    "vcsButtonDownColor":
    {
        "blue": 0.500061,
        "creationClass": "ColorValue",
        "green": 1.0,
        "red": 0.0
    },
    "vcsButtonUpColor"
:
    {
        "blue": 0.0,
        "creationClass": "ColorValue",
        "green": 0.0,
        "red": 1.0
    }

}

Bug? Or compelling reason?

asked Aug 22, 2017 in Controllers, OSC & MIDI by kevin-cole (Adept) (1,050 points)
edited Aug 22, 2017 by kevin-cole

1 Answer

0 votes
It is an array that alternates between key and value (it's a flat representation of a Smalltalk Dictionary object). It was simpler to deal with in Kyma Control as an array.
answered Aug 23, 2017 by ssc (Savant) (128,080 points)
...