TinyBase logoTinyBase β

getTablesSchemaJson

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

getTablesSchemaJson(): string
returnsstring

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.

import {createStore} from 'tinybase';

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.

import {createStore} from 'tinybase';

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

Since

v3.0.0