Reputation: 509
I'm using Parse.com services for an Android application but when I try to get datas from Parse, an error occurs:
com.parse.ParseException: corrupted json: org.json.JSONException: No value for code
Here is the code I use to get the datas:
public void getCategories() {
listCategories = new ArrayList<>();
ParseQuery<Category> query = ParseQuery.getQuery(Category.class);
query.findInBackground(new FindCallback<Category>() {
@Override
public void done(List<Category> categories, ParseException e) {
if (e == null) {
// Clear previously loaded Categories
listCategories.clear();
for (Category category : categories) {
// Fill the list with retrieved Categories
lsistCategories.add(category);
}
}else {
Log.d("Error happened while retrieving data:", e.getMessage());
}
}
});
}
Any idea of what could be the problem?
Upvotes: 2
Views: 231
Reputation: 509
I solved it, in fact I forgot to register my custom Category class in my Application class.
I added this to the onCreate method in my Application class and now it works:
ParseObject.registerSubclass(Category.class);
Upvotes: 2