spring-projects / spring-projects/spring-data-rest
Serializing and Deserializing json in a different format. [DATAREST-614]
@odrotbohm is already working on this.
Since Dec 31, 2020.
- Dominant language
- Java
- Stars
- 958
- Forks
- 568
- PR merge metrics
- No merged PRs in 30d
Description
Jack Matthews opened DATAREST-614 and commented
I need to serialize my json in http://jsonapi.org/ instead of HAL. I have tried modifying ObjectMapper by setting my own converters.
@Bean
public ConversionService conversionService() {
ConversionServiceFactoryBean bean = new ConversionServiceFactoryBean();
bean.setConverters(getConverters());
bean.afterPropertiesSet();
ConversionService object = bean.getObject();
return object;
}
private Set<Converter> getConverters() {
Set<Converter> converters = new HashSet<>();
converters.add(new JsonApiSerializingConverter());
converters.add(new JsonApiDeserializingConverter());
return converters;
}
but this only modifies the "content" part of the payload. It still includes a whole lot of HAL boilerplate. Is there a way to register a custom json format and scrap the HAL one completely? I am happy to do the work in integrating this format but need some pointers in the best way to approach this
Affects: 2.1.6 (Dijkstra SR6)
1 votes, 3 watchers
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Assessment
This issue has not been assessed yet.