Is it a good idea to use JSON as a database?

Asked

Viewed 1,368 times

0

I’m doing a mobile app project. Using Python and Kivy. My project has three main classes to save in a database (it’s a ticket selling app): Tickets, Events and Users.

Searching, I saw that JSON is quite easy to work at first, and it is recommended in the Kivy documentation as one of the usual methods of data permanence.

But I had some doubts (which, unfortunately, I could not remedy in simple research or documentation). The main one: is it feasible to keep JSON as my database? Whereas the app can grow in numbers.

Should I make a JSON file for each class ? (one for users, one for tickets and one for events)

That’s it. If you have any reading recommendations that can clear up those doubts for me, I really appreciate it. I’m starting with the 3 technologies, this should justify the simple doubts.

Thanks for your attention.

  • 2

    JSON is a mere format specification. Database is data stored somewhere (regardless of format, there is the question of storage); It would be nice if you [Dit] and explain better the relationship you want between the two things to be easier to understand the problem in fact. A JSON alone cannot be a Database.

  • I don’t know how to edit this to improve understanding. But I think you’ve helped me. JSON so it’s just a format? What technology could I use along with it then to have a functional database ?

  • 2

    You need to record the data somewhere. If it is Python and will store locally (on the device that runs the application itself), it has Sqlite, which is powerful and super light.

  • I intend to write the data not-locally, after all they will be the same for several users. I’m still not able to understand the truth. The relationship between JSON and the databases, I thought it was a way to store the data good enough for what I want.

  • 1

    In this case JSON can be a format to "chat" with the remote server, where it will run DB. http://json.org - there the application will decode JSON and perform operations on a DB.

  • I think I understand. Can you recommend me some tool so to use as the remote server where will run my DB? Or what would be the next step in my study

  • 1

    It would be nice to search the site itself, and a peek at the related items next to it: https://answall.com/q/272434/70

  • I’ve been working on a project that resembles what you were looking for, a JSON-based database. JSON is a file format that refers to a javascript object (Javascript Object Notation). In python we have "Dict" which resembles an object in JS, but with differences. Instead of creating a DB based on JSON, I did something more similar to Dict syntax. I created my own syntax to differentiate the data when editing manually, but it’s very functional and practical. If you want to follow the project or give some suggestion, follow the link

Show 3 more comments

2 answers

2

Complementing the Alex Ayub:

If your database is relational (that is, each dataset is a table with fixed columns) then you can use Sqlite (import sqlite3 as lite). However, if you plan to keep this app (and base it) on an AWS type screen (and are concerned about scalability, compliance and Adm in general) you should use AWS RDS (in that case you will have to use Mysql or another server solution like SQL Server or Maria DB, etc; but not Sqlite).

1

JSON is a format , for example :

Cliente = {
  Nome: 'Fulano',
  Sobrenome: 'teste',
  Idade: 36
}

This is an example of json, it is a format, moreover today standard to work with the communication between FrontEnd and BackEnd(Apis), the pattern of sending and receiving the data between the parties transit in this format most of the times, even more with the standard restful das API's. As said above is a format, today there are databases NOSQL who work almost instantaneously with JSON, because they work with the same standard of documents, for example the MongoDB. But if you want to record in a database, just put the JSON in the pattern you want and the database you chose to understand, so save the data.

Browser other questions tagged

You are not signed in. Login or sign up in order to post.