Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How can I get Java / Spring MVC to return jsonapi.org ID based format?

I am implementing a JSON API to be used by the Ember-Data REST Adapter.

The Ember-Data REST Adapter needs the JSON returned to follow this format:
http://jsonapi.org/format/

Ember-Data documentation:
http://emberjs.com/guides/models/the-rest-adapter/#toc_json-conventions

I know how to return JSON, say, using Spring MVC 3.2 / Jackson, that's not a problem. However, the JSON format must adhere to the format specified at jsonapi.org.

You can find a sample Django implementation if you google "ember data tastypie adapter" (sorry, not enough reputation points for a link [sic]), and rable also seems to have one.

Seems like jsonapi.org is a much referred to standard for several frameworks / languages.

Do I really need to implement this standard in Java myself?

Any help / pointers would be greatly appreciated.

Many thanks!

like image 613
Sparkling Ideas Avatar asked Mar 19 '26 00:03

Sparkling Ideas


1 Answers

There are some JSON:API implementations for Java:

  • Katharsis with Spring support but somehow dead for years
  • Crnk with Spring Boot 2 support is much more than just JSON:API serializer/deserializer
  • JSON:API for Spring HATEOAS based on Spring HATEOAS and Jackson with Boot 2 support, very lightweight but fresh

To clarify I have not used any of the libraries but if I have to I would try the last one from Kai Toedter unless I have the need for a very large system with JSON:API only so I can benefit from all the additional magic.

like image 141
Arne Burmeister Avatar answered Mar 20 '26 14:03

Arne Burmeister



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!