Data storage on Android, when to use SqlLite and when to use JSON, Linq alternatives

I have several years of experience working with webdev using .Net and C # ... and one of the functions that I really like is linq expressions for querying data. Is there anything that allows Simulair for Android to use to query against JSONs or against the SqlLite database? (I assume I'm looking for a typed expression / query structure).

And for my next question .. Which of the JSON methods and SQLLite approach should I use ... and when? I know this has been asked a million times ... but there seems to be no strict answers.

Is SQLLite for more complex queries and when Im has more data, while JSON is used with less data and not a lot of queries are needed?

Can I save all my JSON data in memmory for faster read / write access? .. since I heard that saving it to / from disk can be a slow process.

But on the other hand, I also heard that SQLLite is slower overall ...

And finally, when we talk about “slow”, it’s slow, as if one read / write scans the entire application for a few milisec or slower than compared to a database in memory that executes queries and is fast, like lightning

+4
source share
3 answers

When to use SQLite

SQLite is one of the forms of saving your data, how to protect your data. Generally, if you want to store more data and have quick access to it (and also if the data is “sensitive”), SQLite is a great choice. Therefore, I do not agree that SQLite is slow, I definitely do not think so.

I have an SQLite database with approximately 650,000 records and still smart performance (sometimes using indexes is required).

When to use JSON

JSON is a lightweight data structure designed to exchange data with a person and what is the main language-independent. This is a very good choice (perhaps the best) if you want to send data over the network (send data to a remote server, etc.), but I think that it is not very good for saving data, and it is unsafe as SQLite.

Generally, you should compare JSON with XML , but you cannot compare SQLite and JSON, which are two different things.

+8
source

General idea

SqlLite: For local storage

JSON: For SideStore Server

+3
source

It makes no sense to compare SQLite and JSON. One of them is a data storage solution, the other is a data format.

You should probably read the official manual before deciding which storage solution to choose (SQLite, preferences, file system, ...): http://developer.android.com/guide/topics/data/data-storage .html

If you want to switch to SQLite persistence, you can use a third-party ORM to simplify queries (for example, ORMLite is the most popular)

+1
source

All Articles