have can I convert this complex json to java class? I am using GSON for parse JSON data.
http://api.feedzilla.com/v1/categories/26/articles.json
Something like this:
Parsing a complex Json Object using GSON in Java
EDIT: I followed this exemple Complex JSON OBJECT USING GSON IN JAVA
This is my class Article:
public class Article {
public String publish_date;
public String source;
public String source_url;
public String summary;
public String title;
public String url;
}
DataStorage class:
public class DataStorage {
public static List<Article> article;
}
MyActivity class:
public class MyActivity extends Activity {
/**
* Called when the activity is first created.
*/
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.main);
AsyncHttpClient httpClient = new AsyncHttpClient();
httpClient.get("http://api.feedzilla.com/v1/categories/26/articles.json", null,
new JsonHttpResponseHandler()
{
@Override
public void onSuccess(int statusCode, Header[] headers, JSONArray response)
{
Log.d("HTTP_RESPONSE", response.toString());
Gson myGson = new Gson();
DataStorage ac = myGson.fromJson(response.toString(), DataStorage.class);
Log.d("HTTP_RESPONSE", response.toString());
//listView.setAdapter(new Adapter(getApplicationContext()));
}
}
);
}
}
After i compile it shows in logcat, why?
12-30 16:22:20.044 1156-1156/com.example.Articles W/JsonHttpResponseHandler﹕ onSuccess(int, Header[], JSONObject) was not overriden, but callback was received