I've written repository implementations that use JSON file as a datastore. But only in tests and local dev, never in production where a database is used as the datastore. A few reasons why JSON files aren't a good fit: JSON has poor type support (as does JS as a language) JSON is bloated when compared to DB implementations that use some sort of binary format: high memory usage when in-memory, higher disk usage when on-disk You need to write operations like filter, fetch, merge etc. your self that the database implementation drivers normally offer and hide from user (obviously this could be written as library code) ACID in databases are offered by the engine which you need to implement yourself. You mentioned data loss as one DB engines allow scaling vertically or horizontally if needed Database engines offer optimisations and indexing by way smarter people than either of us. Also the data can easily be crypted and backed up if desired So unless the projects have very few, non-concurrent users and you don't mind paying big bucks for a server, I'd suggest moving along with a database. Be it document store, key-value store or relational database Answer from 8bitlives on reddit.com
๐ŸŒ
MongoDB
mongodb.com โ€บ resources โ€บ basics โ€บ databases โ€บ json-database
What Is A JSON Database? | All You Need To Know | MongoDB | MongoDB
JSON databases are part of the NoSQL family of databases that offer flexibility in storing varied data types and easily accommodating changes in data model or project requirements.
๐ŸŒ
Reddit
reddit.com โ€บ r/node โ€บ does anyone use json files as a database? best practises? or should i use a "real" database?
r/node on Reddit: Does anyone use JSON files as a database? Best practises? Or should I use a "real" database?
January 29, 2023 -

I've been using JSON files to store data since I began learning Node, but I'm now working on big projects so I need 0% chance of losing data.

I had a problem where Node crashed while writing to a file and I was left with half a JSON file, but I guess this can be solved by writing to a temp file first and then moving it to where the original file is.

I like how easy it is to just use JSON files as databases. I can very easily read data, amend it, and save it in one line each. No packages to install and learn how to use. I try to use no NPM packages where possible because I like learning how to do things myself and time isn't an issue and I'm the only one working on these projects.

I also read a comment by someone who makes directories for arrays and individual files for objects instead of using one single JSON file per table.

If someone could enlighten me on why JSON files might not be a good idea for production, or if there are some things I should know before doing this, that would be really helpful.

๐ŸŒ
Amazon Web Services
aws.amazon.com โ€บ databases โ€บ amazon documentdb โ€บ what is json
What is JSON? - JSON Explained - AWS
2 days ago - A JSON document database is a type of NoSQL database that is designed to store and query data as JSON documents, rather than normalizing data across multiple tables (each with a unique and fixed structure) as in a relational database. JSON document databases use the same document-model format ...
๐ŸŒ
Quora
quora.com โ€บ Is-it-okay-to-use-JSON-as-a-database
Is it okay to use JSON as a database? - Quora
Answer (1 of 15): JSON is not a database, it is a file format. You can use JSON in text columns if you want to of course. Also, there may be non-sql databases that use JSON as query language, e.g. Elastic Search does that I think
๐ŸŒ
Redis
redis.io โ€บ home
A Guide to Understanding JSON Databases | Redis
March 27, 2025 - The data is expressed in text-based documents rather than in the column or tabular form you may be familiar with from SQL databases. Structurally, a JSON database is a NoSQL database that reads and stores semi-structured data using JSON documents, ...
๐ŸŒ
RxDB
rxdb.info โ€บ articles โ€บ json-database.html
RxDB - The JSON Database Built for JavaScript | RxDB - JavaScript Database
Storing data as JSON documents in a NoSQL database is not just a trend; it's a practical choice. JSON data is highly compatible with various tools and is human-readable, making it an excellent fit for modern applications.
๐ŸŒ
Couchbase
couchbase.com โ€บ home โ€บ what is a json database & why are they useful?
What Is a JSON Database & Why Is It Useful? Examples & More
June 14, 2025 - My family hears me talk about JSON databases rather frequently. Naturally, I had to explain that Jason is not the owner of my company! Instead, many modern databases use JSON as a data format.
Top answer
1 of 4
59

You can use any single file, including a JSON file, like this:

  • Lock it somehow (google PHP file locking, it's possibly as simple as adding a parameter to file open function or changing function name to locking version).

  • Read the data from file and parse it to internal data stucture.

  • Optionally modify the data in internal data structure.

  • If you modified the data, truncate the file to 0 length and write new data to it.

  • Unlock the file as soon as you can, other requests may be waiting...

  • You can keep using the data in internal structures to render the page, just remember it may be out-dated as soon as you release the file lock and other HTTP request can modify it.

Also, if you modify the data from user's web form, remember that it may have been modified in between. Like, load page with user details for editing, then other user deletes that user, then editer tries to save the changed details, and should probably get error instead of re-creating deleted user.

Note: This is very inefficient. If you are building a site where you expect more than say 10 simultaneous users, you have to use a more sophisticated scheme, or just use existing database... Also, you can't have too much data, because parsing JSON and generating modified JSON takes time.

As long as you have just one user at a time, it'll just get slower and slower as amount of data grows, but as user count increases, and more users means both more requests and more data, things start to get exponentially slower and you very soon hit limit where HTTP requests start to expire before file is available for handling the request...

At that point, do not try to hack it to make it faster, but instead pick some existing database framework (SQL or nosql or file-based). If you start hacking together your own, you just end up re-inventing the wheel, usually poorly :-). Well, unless it is just programming exercise, but even then it might be better to instead learn use of some existing framework.

2 of 4
4

I wrote an Object Document Mapper to use with json files called JSON ODM may be a bit late, but if it is still needed it is open source under MIT Licence.

It provides a query languge, and some GeoJSON tools

Find elsewhere
Top answer
1 of 6
50

I think your question really boils down to: When should I use a NoSQL approach vs. RDBMS? You settled on JSON early (a NoSQL-ish decision), perhaps because you've got Ajax consumers.

The answer of course to when to use NoSQL approaches vs. RDBMS's is basically about what type of data you're working with and what consumers you anticipate having. If your data is essentially relational (fairly flat hierarchies, no weird data types like images or audio, predictable relationships between the schemas that can be easily described in keys), and your consumers are anticipated to eventually include people who want to do Business Intelligence queries (ad hoc querying), then an RDBMS is the way to go. It's fairly easy to turn a query into a JSON representation, so it doesn't significantly burden your Ajax consumers -- it just adds a little transformation coding into your endpoints (REST/SOAP/whatever). Conversely, if your data is very hierarchical (deep schemas), contains weird data types like images, audio, video, etc., there are few relationships between entities, and you know that your end users will not be doing BI, then NoSQL/storing JSON may be appropriate.

Of course, even these general guidelines aren't rock solid. The reason Google developed Google File System, MapReduce (work which was used by Doug Cutting to build Hadoop at Yahoo) and later BigQuery (a NoSQL oriented [schemaless] way of managing large scale data) was precisely because they had a lot of ad hoc BI requests, and they couldn't get relational approaches to scale up to the tera/peta/exa/zetta/yotta scales they were trying to manage. The only practical approach was to scale out, sacrificing some of ad-hoc-query user friendliness that an RDBMS provides, and substituting a simple algorithm (MapReduce) that could be coded fairly easily for any given query.

Given your schema above, my question would basically be: Why wouldn't you use an RDBMS? I don't see much of a reason not to. Our profession is supposed to be engineering oriented, not fashion oriented, so our instinct should be to pick the easiest solution that works, right? I mean, your endpoints may have to do a little translation if your consumers are Ajaxy, but your data looks very flat and it seems likely that business users are going to want to do all kinds of ad hoc querying on things like music events (Which event was most attended within 50 miles of our capital city last year?)

'Go not to the elves for counsel, for they will say both no and yes.' -- Frodo

2 of 6
6

I believe there are more considerations here that you may not be looking for. There are two broad concerns here:

  • Storage
  • Search and Retrieval

Storage

There are plenty of opinions on why to use no-sql or RDBMS store for your data. One of the most important items that we thought was useful is that we can easily define and store json objects in storage without having to worry about defining it's full structure or relationship between different types of objects. Some of the other reasons to use a NoSql db would be ability to auto shard data, location based searches and easy maintenance. There are many good NoSql databases out there, my personal preference is MongoDB. However, if you have not used NoSql database before, there is a definite learnign curve as you learn to re-wire your mind. Most of us have been using RDBMS for a while now and it takes conscious effort to break out of that habit. Plus you will find yourself wanting to redo your data model as you proceed along with your efforts and have a better usnderstanding of concepts. If ability to refactor or remodel is not an options for your project I would suggest to stick with what you already know best.

Search

If you intend to provide any kind of search that is usable, I strongly suggest that you use a dedicated text search engine such as SOLR to perform your searches. Text searches are slow and if you have multiple shards then even more so slower. SOLR supports blazing fast text searches including weighted search params, location based searches and much more. SOLR however is not suited as a primary store of your data. This does mean that you will have to create mechanisms for dual insert and update to both you primary database and your SOLR layer when adding or updating events. Plus you will have to keep the SOLR later updated by removing any outdated/ended events.

Although this does seem like lot of extra work you will thank yourself for foresight of using a full text search engine later on. None of the NoSql databases or RDBMS come close to performance and agility of SOLR/Lucene.

๐ŸŒ
ClickHouse
clickhouse.com โ€บ resources โ€บ engineering โ€บ json-database
What is a JSON database? | Engineering | ClickHouse Resource Hub
November 6, 2025 - There isnโ€™t really such a thing as a JSON (JavaScript Object Notation) database, but there are databases that are designed to work well with JSON data or have strong JSON support.
๐ŸŒ
RxDB
rxdb.info โ€บ articles โ€บ json-based-database.html
JSON-Based Databases - Why NoSQL and RxDB Simplify App Development | RxDB - JavaScript Database
Whether you're building a real-time dashboard or a fully offline mobile app, storing and querying data in a JSON-friendly way can reduce overhead and coding complexity. This is where JSON-based databases (often part of the NoSQL family) come into play, letting you store objects in the same format they're used in your code, eliminating the schema wrangling that can come with a strict relational design.
๐ŸŒ
Wikipedia
en.wikipedia.org โ€บ wiki โ€บ JSON
JSON - Wikipedia
March 6, 2005 - For faster processing at the cost of human-readability, data interchange formats that can express all JSON objects include CBOR (an IETF RFC standard) and Ion binary. Google Protocol Buffers can also fill this niche due to the ability to be parsed without a schema, but it is not intended as an interchange language. In addition, databases such as SQLite and PostgreSQL have their own internal binary representations called "JSONB", not intended for outside use.
๐ŸŒ
Pinata
pinata.cloud โ€บ blog โ€บ will-json-work-as-a-database
Will JSON Work As a Database?
October 3, 2024 - JSON is a powerful data format, but itโ€™s also a lightweight option for storage and data replication. It can be used as a primary database in some cases, as a syncing tool, or for populating local-first apps.
๐ŸŒ
Qlik Community
community.qlik.com โ€บ t5 โ€บ Data-Quality โ€บ Does-anyone-use-JSON-files-as-a-database-Best-practises-Or โ€บ td-p โ€บ 2458546
Does anyone use JSON files as a database? Best practises? Or should I use a "real" database?
June 3, 2024 - I like how easy it is to just use JSON files as databases. I can very easily read data, amend it, and save it in one line each. No packages to install and learn how to use.
๐ŸŒ
GeeksforGeeks
geeksforgeeks.org โ€บ dbms โ€บ why-nosql-json-databases-are-so-useful
Why NoSQL JSON Databases Are So Useful - GeeksforGeeks
July 23, 2025 - It stores data in a human-readable format in JavaScript Object Notation(JSON). In this article, we will learn the reasons why the NoSQL JSON databases are useful. In JSON databases the data is stored in documents that are like labeled containers.
๐ŸŒ
Percona
percona.com โ€บ home โ€บ json and relational databases โ€“ part one
JSON and Relational Databases - Part One
December 15, 2022 - This approach to never-ending incrementalism is not optimal for database operations. The Achilles Heel of unstructured data is that it is hard to apply rigor to the data. Making a key/value pair a required item or of a certain data type or format is not part of the JSON standard.
๐ŸŒ
Oracle
oracle.com โ€บ ai database
What is JSON?
April 4, 2024 - JSONโ€™s language-independent nature makes it an ideal format for exchanging data across different programming languages and platforms. Many databases have emerged to store and exchange data in JSON.
๐ŸŒ
W3Resource
w3resource.com โ€บ JSON โ€บ introduction.php
JSON Tutorial | w3resource
JSON uses objects and arrays - objects are label-value pairs and arrays are the list of values. They can be nested recursively. Metadata : In a relational database, it is a schema, which is used for storing data about the structure and type of the data to be stored and schemas are predefined, i.e.
๐ŸŒ
SingleStore
singlestore.com โ€บ blog โ€บ what-is-json-
What Is JSON? | SingleStoreDB: The Real-Time Analytics Database
November 29, 2023 - JavaScript Object Notation, more ... applications. JSON has revolutionized the database industry over time, as evidenced by the use of JSON as the underlying data storage format in NoSQL databases, like SingleStore....
๐ŸŒ
Quackit
quackit.com โ€บ json โ€บ tutorial โ€บ list_of_json_databases.cfm
List of JSON Databases
List of database management systems that support JSON. Here's a list of database management systems (DBMS) that support JSON.