Is JSON good for storing data

It’s been a looonggg time since I’ve posted anything here.

I have a website (, and it uses JSON for a database structure.
Should I convert it to MySQL, or is JSON good enough…

If this file will exceed 10mb, then you will be better off using MySQL


alright, thanks :slight_smile:

1 Like

Using JSON to store data of your website can work, but there are a lot of caveats you need to be aware of:

  • There is a 10 MB file size limit on our hosting. If your JSON file exceeds that limit, it will be deleted.
  • If you don’t setup .htaccess rules to prevent this, the JSON file will be publicly accessible and can be downloaded by anyone who knows the URL.
  • A JSON file doesn’t have write locking or transactions. If there are two visitors at the same time making changes to the file, it’s very likely that the changes of one of the two users will be overwritten by the other user and lost.
  • A JSON file doesn’t have any kind of indexing. It’s typically used by loading the entire file into memory and iterating over it, which becomes very slow very quickly as your database grows larger.

Using JSON to store data works fine if the data is never changed by users, and the amount of data is fairly small.

MySQL is purpose built as a database, which a simple file is not, so it doesn’t suffer from any of these issues.

And if you feel a JSON file is a bit too simple and MySQL is a bit too complex, you could also consider using SQLite, which is also a SQL database, but stored as a single file (but with proper write locking, schemas, indexing, etc.)


Thank you!
I have decided to move to MySQL, since it is more convenient…

This topic was automatically closed 15 days after the last reply. New replies are no longer allowed.