TinyBase logoTinyBase

getTablesSchemaJson

The getTablesSchemaJson method returns a string serialization of the TablesSchema of the Store.

getTablesSchemaJson(): Json
returnsJson

A string serialization of the TablesSchema of the Store.

If no TablesSchema has been set on the Store (or if it has been removed with the delTablesSchema method), then it will return the serialization of an empty object, {}.

Examples

This example serializes the TablesSchema of a Store.

const store = createStore().setTablesSchema({
  pets: {
    species: {type: 'string'},
    sold: {type: 'boolean'},
  },
});
console.log(store.getTablesSchemaJson());
// -> '{"pets":{"species":{"type":"string"},"sold":{"type":"boolean"}}}'

This example serializes the TablesSchema of an empty Store.

const store = createStore();
console.log(store.getTablesSchemaJson());
// -> '{}'

Since

v3.0.0