[Project] Json Database

Hello guys, we are working new project with @justpw
this is work in progress now we are just want pls do test and respond here :slight_smile:

  • What does it do:

its new database project not using Heidisql, using json files and its not influence to MYSQL values

  • How to use:

All are in the readme.md

Download

12 Likes

Do you think a Json DB will be performing better than a mysql DB?

Of course, because mysql is using queries, it’s doing requests to a server and waiting for answer. JSON will only write lines to a file.

Good project !

1 Like

Why not just use MongoDB?

I’m getting deja vu.

JSON is just not a database no matter how much you want it to be. It was never meant to manage data, just represent it. If you want to shift from MySQL for performance reasons why not try MongoDB? It’s non-structured manner is pretty performant compared to MySQL. (Don’t quote me on this)

I used to think the two were interchangeable because they were both pretty much ways of storing information, although storing and using JSON files was easier to me at the time. Databases are separate pieces of software that make retrieving data much faster and don’t end up being bloated over time. Also, carrying all the data in one or two files makes it dangerously easy to end up getting your data stolen or lost, where as a database is much more secure with those. Fundamentally, data shouldn’t be part of your code; it should be a separate thing that your code works with.

From stack overflow

MySQL is a database while JSON is not, so the correct answer is MySQL, without hesitation. JSON is just a language, and barely even that. JSON was never designed to handle anything like concurrent connections or any sort of data manipulation, since its own function is to represent data, not to manage it.

So go with MySQL for storing the data. Then you should use some programming language to read that database, and send that information as JSON, rather than actually storing anything in JSON.

If you store the data in files, whether in JSON format or anything else, you will have all sorts of problems that people have stopped worrying about since databases started being used for the same thing. Size limitations, locks, name it. It’s good enough when you have one user, but the moment you add more of them, you’ll start solving so many problems that you would probably end up by writing an entire database engine just to handle the files for you, while all along you could have simply used an actual database.

Great idea but I can’t imagine this being scalable even one bit. Imagine having even just 200+ players.

this is not same they work
actually we dont know this guy

we only want do different, It doesn’t matter if it’s good or bad

hmm good job :kissing_heart:

1 Like

In the case of +200 players, this system’s failure is apparent.

PROS:
Easy syntax
Way too lightweight than MySQL
Way too faster I believe?

CONS:
Limited tools
No error handler
JSON ain’t a Programming Language or a database engine it’s just a file type where you can easily store some data in it.
You can’t really compress the JSON file cuz of data corruptions but MySQL does that already.

Conclusion:
If I really would like to use JSON to store data I would go for MongoDB or mongoose

1 Like

Also as KvP warrior might I add that KvP exist and fully supports json as well. Might consider it even more secure and easier to use.

You could use BSON to decrease file size.
I have no experience with BSON, but I know MongoDB uses it, and I used MongoDB for a while, so I assume when a popular database software uses it, it would be good, right?

1 Like

Consider this scenario:

  1. Script A wants to update player X’s money.
  2. Script B also wants to update player X’s money.

Assuming they ran at the same time
Flow:
Script A reads X’s money = $100
Script B reads X’s money = $100
Script A does this: X[money] = $100+ 50(example) = $150 and saves to JSON
Script B does this: X[money] = $100 + 20(example) = $120 and saves to JSON

This won’t work. There are many scenarios just like this that are caused because your script isn’t really queueing requests.

It’s a decent attempt but you should just go the established route. There’s a reason why DB’s exist.

4 Likes

As said before it is in fact a decent attempt, but I must agree with @TritonXVII , It won’t work and perform well in servers.

@SnipeOpGaming This is what I was talking about the other day.

Don’t tell me PS is gonna use it

Json database will not be possible, with the amount of data your trying to write and read non stop its going to constantly error out and get the wrong data. Json isnt ment to be written and read from constantly non stop. (Ask qb-core before they changed management from json it would cause problems non stop and that was 2 json files for 1 resource.)

The only way it would slightly be possible is by having 1 json file per character and/or resource and that way you would be left with like 200+ files.

Check out any big discord bots for an example they use sql because json cant keep up with the requests needed by alot of clients at the same time.

No lol. Just a convo topic we had pop up about usability of json with FiveM.

great point

1 Like