How to create a 'dictionary' object? ie. list of name/value pairs

i can create one by using ParseJson(’{“x”:1, “y”:2, “z”:3}’)
and it works great

and i can create a row in a table where the column names and values are treated as such an object

but inside a formula, can i generate such an object easily?

is there an Object() function ala List() i could use?
or is there a notation in coda to do this (like JSON in JS)?

respect
max xyzor

1 Like

As a matter of fact, there is an Object() formula now :slight_smile: It’s hidden because it’s added in preparation for a bigger update, but it’s there
image

However, there seems no “legal” way to extract a name by value yet. There’s only this _Deref_Object(), another hidden formula, but it cannot look into nested object (the parameter path is not really a path but only a top-level key, and you cannot chain multiple _Deref_Object()s):
image
image

many thanks @Paul_Danyliuk, thats exactly what i needed.

but i must assume _Deref_object() is just a temporary measure and we will eventually be able to use the ‘dot’ operator to dereference keys in the object

so the expression

        Object('XXX','111', 'YYY','222').YYY 

will return ‘222’, yes?

max

1 Like

I have tried the Object() and List() and they are useful, BUT…
the limitations of the _Deref_Object() means I am sticking with ParseJSON() function for now.

It allows me to generate arbitrary complex data structures and dereference then with the Path argument.

For example, here are some experiments I have been doing, and using LaTeX to generate a graphical representation as well…


For increased clarity, I dont use quotes in my JSON code as I add them later with a RegexReplace().

1 Like