How to debug configuration rebuild errors using custom JsonDeserializer?

I checked the server response and it will deserialize to Map without problems.

As soon as I attach my deserializer, Retrofit throws a RetrofitError with type conversion, but no other exceptions are thrown, even if I set the Retrofit logging level to LogLevel.FULL.

How can I debug my custom deserializer to check where the error comes from?

-

I get json from wordpress blog and deserialize it with this

public ArrayList<Post> deserialize(JsonElement json, Type typeOfT, JsonDeserializationContext context) throws JsonParseException {
    Log.d("WayTrace", "Starting Parsing " + json);
    final JsonObject jsonObject = json.getAsJsonObject();
    Log.d("WayTrace", "JSONObject " + jsonObject);
    final JsonArray posts = jsonObject.get("posts").getAsJsonArray();
    Log.d("WayTrace", "JSON posts " + posts);
    final ArrayList<Post> outList = new ArrayList<>(posts.size());
    for (int i = 0; i < posts.size(); i++) {
        final Post post = new Post();
        Log.v("WayTrace", "JSON posts parsing item " + i);

        post.setPostId(jsonObject.get("id").getAsInt());
        post.setTitle(jsonObject.get("title").getAsString());
        post.setExcerpt(jsonObject.get("excerpt").getAsString());
        post.setContent(jsonObject.get("content").getAsString());
        post.setImageUrl(jsonObject.get("thumbnail_images").getAsJsonObject().get("full").getAsJsonObject().get("url").getAsString());
        post.setThumbUrl(jsonObject.get("thumbnail_images").getAsJsonObject().get("post-thumbnail").getAsJsonObject().get("url").getAsString());
        post.setPostTimeStamp(this.mTstampParser.parseMillis(jsonObject.get("date").getAsString()));

        outList.add(post);
    }

    return outList;
}

But even those log commands do not appear in my log.

+4
source share

All Articles