Use CRUD operations on JSON with SQL queries.
$ npm i --save json-sql-queryNote: This library is very new and does not support most of the statements
const{ Database }=require("json-sql-query");// file basedconstdb=newDatabase("./database.json");// in-memoryconstdb=newDatabase(":memory:");// creating a tabledb.prepare(`CREATE TABLE IF NOT EXISTS "DEMO" ("key" TEXT, "value" TEXT)`).run();// inserting datadb.prepare(`INSERT INTO "DEMO" ("key","value") VALUES ("test_key", "test_value")`).run();// fetching datadb.prepare(`SELECT * FROM "DEMO"`).run().parse();// fetching data in limitdb.prepare(`SELECT * FROM "DEMO" LIMIT 3`).run().parse();// returns 3 items if available// update existing datadb.prepare(`UPDATE "DEMO" SET "value" = "test data" WHERE "key" = "test_key"`).run()// delete specific itemdb.prepare(`DELETE FROM "DEMO" WHERE "key" = "test_key"`).run();// drop a tabledb.prepare(`DROP TABLE "DEMO"`).run();