3
I read several tutorials on how to take a JSON and pass the information to an Sqlite, but as I do the reverse, I take the application data already saved in Sqlite and then transfer them to a webservice with JSON... I thank you from now on
3
I read several tutorials on how to take a JSON and pass the information to an Sqlite, but as I do the reverse, I take the application data already saved in Sqlite and then transfer them to a webservice with JSON... I thank you from now on
2
Add google’s Gson dependency to your Google, have in m2Repository, you will do your search in the normal database, turn into a normal java object and then just call gson so
new Gson().toJson(object).build();
I can’t remember exactly if it’s like this, if that’s what you really want, I recommend taking a look at the Gson documentation, it’s a great class, always use, so simple I don’t even remember how I do...
In the documentation you have annotations that you can make in your classes to be able to customize the json, take a field or not and change the name it comes in json...
https://github.com/google/gson/blob/master/UserGuide.md#TOC-Goals-for-Gson
I believe this link will satisfy your doubts...
Browser other questions tagged android database json sqlite
You are not signed in. Login or sign up in order to post.
This depends on the language you will use..
– Marco Giovanni
The most important thing to set is WHEN the data will exit the sqlite and go to the external database via the webservice. Is at the click of a button? Is it without the user knowing? Is it when the application opens? Depending on the answer, you will take a different approach. As for technology: It is recommended to use a library called Gson to transform its object into json. The webservice has to have an identical class that you are sending so that it can convert the json that arrives in the class to finally perform the Inserts in the external bank.
– Mr_Anderson
I will use Java... want q the application do without the user knowing, if it is connected it updates if nothing changes in internal BD
– Projeto Bentotec
I’ve even built an internal BD using Sqlite, now I want to create a webservice to start passing the information to the network and leave it stored online
– Projeto Bentotec