Change JSON format for spring -data-rest

Currently, spring-data-rest returns HAL JSON in my spring-boot project. I am using the ember.js interface and want to use jsonapi ( http://jsonapi.org/ ).

How can I register a new JSON formatting strategy, given that I will need to write the formatting myself since it does not exist yet?

+5
source share
1 answer

So you can configure HATEOAS what Spring Data REST produces:

https://docs.spring.io/spring-data/rest/docs/current/reference/html/#customizing-sdr.customizing-json-output

If you need to completely replace the JSON representation with your own, you can write and register your own org.springframework.core.convert.converter

Or you write your custom REST endpoints in the plain old @RepositoryRestController and implement your own REST endpoints. (<= I suggest trying this)

0
source

Source: https://habr.com/ru/post/1214625/


All Articles