문제

I am trying to create a serialization layer which allows me to:

  • Store my classes in a MongoDB data source
  • Convert them to JSON to use them in a REST API.

Some classes are clearly not case classes (because they are inherited from a Java codebase) and I would have to write ad-hoc code for that. Is registering a BSON Hook for my non standard type the correct approach, and does it provide Json serialization?

도움이 되었습니까?

해결책

Salat maintainer here.

You might prefer to create a Salat custom transformer instead of registering a BSON hook with Casbah.

See simple example and spec.

If you run into any issues, feel free to ping the mailing list with a small sample Github project that demonstrates what isn't working.

라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top