JSON is a file format. Don’t get caught up in that being a requirement for what you want.
You’re looking for a document oriented database. Many exist, use that as your search term instead of JSON.
JSON is a file format. Don’t get caught up in that being a requirement for what you want.
You’re looking for a document oriented database. Many exist, use that as your search term instead of JSON.
Yeah, sure. Just make your own token ring system to split up the JSON across multiple files based on some unique composite key. Then wrap everything in a script using jq that gets your functions get(path) and returns the document matching that "query" rofffl
In principle, you're looking for a "document-oriented database": https://en.wikipedia.org/wiki/Document-oriented_database
CouchDB is what I usually see recommended as an alternative to MongoDB and might fit your bill (although I haven't worked with it yet): https://couchdb.apache.org/
Yes. It's called a filesystem.
There's duckdb.
Json is for humans, not for storage
Json is for humans, not for storage
JSON is not for humans. If I can't write arbitrary multi-line comments in the text file, it's not for humans.
JSON is, as described by the standard defining it, for computers talking to each other:
JSON is a […] syntax for defining data interchange formats.
If you want a format writable and readable by humans? We deserve better.
Tell that to postgres's json and json. But you're completely correct here, just because you can do something doesn't mean it's a good idea.
Jq is a non SQL JSON query language.
Why would one want to learn an entirely separate language, just to query their database? get("users.Jane33") is far superior. It stays in the language you're using. You don't have to develop your own library to interact with your database, which is an entire abstraction layer. And you're pulling exactly what you need, especially if the data is hash addressed. You're not sorting through hundreds of records to find the one that matches what you want, and supplying a masking pattern to weed out everything else.
SQL has been a pain in the @$$ for development for years. It's a bad design. Has been for a very long time.
MongoDB also has its own query language and works on JSON documents. The syntax you've got is similar to most languages' dict addressing. The problem you'll have in Python though is running into memory limits pretty quickly.
I'm unsure if your ultimate goal but I encourage you to build something awesome with all this energy and ideas!
Maybe a different kind of solution to what you're looking for, but JSON-LD does this in a distributed (multi-system) manner. Maybe a little more distributed than you want, though.
Essentially, you can use IRIs (and IRI references) to point to specific objects/subtrees. The thing is, IRIs are usually dereferenceable as URLs that point to the object's value, so you'd use a HTTP client to fetch it in order to dereference the data.
It's used by Lemmy of course (and ActivityPub in general), and it's mostly designed when you have different people publishing JSON documents that want to link to each other.
More along the lines of what you're probably looking for is any NoSQL document database. You want to be able to set an index within the document that the database can use for fast lookups. There's a ton out there, so not much point listing them here when you can find lists online very easily.
Personally, I'd rather just use a SQL database for this though. To begin with, you wouldn't design your database to be a single, large, ever-growing JSON document, but rather several JSON documents (one per "object" being stored, like one per user). This allows your distributed database to split the load on requests coming in via sharding as well as help it quickly find what you're looking for (assuming your query is on an indexed key). SQL databases let you better structure the data you actually intend to query on (IDs, names, whatever), and you can put whatever other attached data you want as a JSON field (Postgres JSONB for example).
all 34 comments