jsondatabaseserverside-javascriptdatabase-server

What are the drawbacks to a JSON server-side data storage file?


I'm looking for alternative data storage methods to SQL (That is to say, I do not want to use SQL, even for queries) and came across a few based on JSON. Talking with friends who do database work, they said I shouldn't consider these, but wouldn't elaborate. What are the potential (and practical) drawbacks to using JSON as a data storage file format?


I figured JSON would be better than SQL for these reasons:

  1. JSON is strictly defined and doesn't have flavors (Oracle, Microsoft, MySQL, etc.)
  2. Since Google started making Chrome, JS interpreters have made reading, parsing, and outputting JS (and thus JSON) a very fast and easy process.
  3. Database output could be pure JSON, erasing the need for a middle-man interpreter for browsers, etc.

among others...


Solution

  • I think you might want to take a look at NO-SQL databases: https://en.wikipedia.org/wiki/NoSQL

    If you like using JSON-like data, then one I have personally used is MongoDB.

    I have not used it as a main/single source of my app data, but only for secondary purposes. But, I guess, you can try using it as your main data storage too (I think many people do).

    What I have tried, and was quite satisfying, was MongoDB with C# and using MongoVue as a GUI application for executing queries and interaction with the DB. I was not very happy with MongoVUE, but it seems that it was the best option at the time.

    However, SQL DBs are very good at defining relationships in your data. E.g. referencing an entry on table A from an entry on table B, and that kind of stuff. Using those relationships, you can join tables and do many interesting things. I think, it is good for you to get some experience on this field as well.

    MongoDB is not build for defining relationships (as far as I understand). It has the concept of "documents", where you store information in a JSON like format (with nested key/values). You can query documents, but joining seems like hacking your way around its normal usage: How do I perform the SQL Join equivalent in MongoDB? Also, ensuring data consistency (in a truly reliable manner) when using relationships in MongoDB seems pretty impossible to me. But even if I am wrong and it is possible, it will be 10 times harder achieving it than with SQL DBs.

    But you can have a look at the list in WikiPedia and there might be a better alternative than MongoDB for you.

    But you can use pure JSON as well with no DB system.

    So, in summary JSON-like storage has (at least) these issues: