const { jaysn } = require('jaysn');
const schema = {
posts: {
id: 'number',
title: 'string',
author: {
id: 'number',
},
},
};
const postData = {
id: 1,
title: 'Post User 34',
author: {
id: 1,
},
};
const db = jaysn(schema);
db.set('posts', [postData]).write();
console.log({db: db.getState(), posts: db.get('posts')});