Skip to content
Share
Explore

Generate Schema

Prabhjot Singh Lamba

Standalone Formula Example

Input:
'{"name": "Prabhjot", "skills": ["Programming", "Marketing", "Designer", "3D Artist"]}'
Output:
coda.makeObjectSchema({properties: { name: { type: coda.ValueType.String }, skills: { type: coda.ValueType.Array, items: {type: coda.ValueType.String} }}})

Table Formula Example

NOTE:
Create the json structure in and copy value from there in the Json Value column
You can copy schema code value and paste into your own packs
Coda Columns Quotation “” gives an error on calling JSON.parse() so writing JSON directly in Json Value column won’t work.
Get Schema Code
Json Value
Schema Coda
{"a": [{"b": 2, "c": [1,2,4]}]}
coda.makeObjectSchema({properties: { a: { type: coda.ValueType.Array, items: {type: coda.ValueType.Object,properties: { b: { type: coda.ValueType.Number }, c: { type: coda.ValueType.Array, items: {type: coda.ValueType.Number} }}} }}})
[3, 6, 7]
coda.makeSchema({type: coda.ValueType.Array, items: {type: coda.ValueType.Number}})
{"name": "Prabhjot"}
coda.makeObjectSchema({properties: { name: { type: coda.ValueType.String }, }})
{ "array": [ 1, 2, 3 ], "boolean": true, "color": "gold", "null": null, "number": 123, "object": { "a": "b", "c": "d" }, "string": "Hello World" }
coda.makeObjectSchema({properties: { array: { type: coda.ValueType.Array, items: {type: coda.ValueType.Number} }boolean: { type: coda.ValueType.Boolean }, color: { type: coda.ValueType.String }, number: { type: coda.ValueType.Number }, object: { type: coda.ValueType.Object, properties: { a: { type: coda.ValueType.String }, c: { type: coda.ValueType.String }, } }string: { type: coda.ValueType.String }, }})
There are no rows in this table

Bonus Formula: Get Data Type of any Json object

Get Data Type
There are no rows in this table

Want to print your doc?
This is not the way.
Try clicking the ··· in the right corner or using a keyboard shortcut (
CtrlP
) instead.