Gson @Expose equivalent in Java SDK?

Hi @Kademlia,

the Java SDK in the released version does not support POJO to JSON mapping, like GSON or Jackson does. Currently, there are two ways to handle this:

  • You can use the JsonDocument with its JsonObject and JsonArray and you fill those objects on your own and then store it (so you are manually binding your POJO to JsonObject)
  • You can keep using GSON with your annotations and take the raw JSON string that is created and store it through the RawJsonDocument (which accepts the JSON string).

That should have you covered. That said, in the upcoming version we are working on exactly that feature: mapping your domain objects directly to JSON, without having to use a third party library. This is currently in the works and with the next developer preview (which is coming out soon), I’d appreciate any feedback you have there!

1 Like