creating and reading JSON files
Nanowrimoijk (25)

wondering how to set up a JSON database and how to read it in JS

You are viewing a single comment. View All
heyitsmarcus (280)

First off, great question!

I believe you are talking about NodeJS, just given some of your repls in your profile, so I'm going to show a solution that I use (and love) in NodeJS.

A great JSON database is NeDB which makes it a piece of cake to work with JSON data. It is almost a duplicate of MongoDB which means that it is a NoSQL database. You can save, load, query, etc. all kinds of data. Here's a simple example of storing some JSON data into the database and then retrieving it: https://repl.it/@heyitsmarcus/NeDB-Test

Also, here is a great article on more NeDB functionality (and where I copied some of the code out of because I'm lazy): https://stackabuse.com/nedb-a-lightweight-javascript-database/

I really hope this helps!

If this helped solve your problem, please consider upvoting and marking my answer as the accepted answer to close this question. I'll continue to answer any questions you might have, though.