I'm trying to get JSON data into Sugar ORM objects, so that I can use these without having to get JSON data from a server. I'll just simply download a zipfile (which contains a JSON file) and unzip it so that it is ready for use. Whenever I update the JSON data, I'd just download the new zip file and replace the old JSON data.
An example of my JSON file could be:
{
"id": "1",
"title": "JsonTitle",
"location": {
"city": "RightHere",
"street": "OnTheCorner",
"type": "Road"
}
My model class would look like this:
public class Example extends SugarRecord {
//setters and getters
}
How would I populate the Sugar ORM objects with this JSON data?
If I understood right, you want to serialize json to Java Object.
To do that you have multiple solutions:
You can find samples on the main pages of these projects.