Retrofit and Jackson and parsing JSON

前端 未结 2 1625
攒了一身酷
攒了一身酷 2021-02-02 13:48

I am using Retrofit with Jackson. For some reasons I cannot parse the following JSON:

[
    {
        \"ProfileImage\": null,
        \"UserName\": \"joe\"
    }         


        
2条回答
  •  礼貌的吻别
    2021-02-02 14:39

    Use Square's converter by adding this to your build.gradle:

    compile 'com.squareup.retrofit:converter-jackson:1.9.0'
    

    Afterwards you can activate it by adding .setConverter(new JacksonConverter()) to your RestAdapter builder.

提交回复
热议问题