小智 2
https://github.com/jasminb/jsonapi-converter就是您要找的
从文档
// Create object mapper
ObjectMapper objectMapper = new ObjectMapper();
// Set serialisation/deserialisation options if needed (property naming strategy, etc...)
Retrofit retrofit = new Retrofit.Builder()
.baseUrl("https://yourapi")
.addConverterFactory(new JSONAPIConverterFactory(objectMapper, Book.class, Author.class))
.build();
// Create service using service interface
MyBooksService booksService = retrofit.create(MyBooksService.class);
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
1343 次 |
| 最近记录: |