vertx-eventbus-bridge-clients
vertx-eventbus-bridge-clients copied to clipboard
EventBus doesn't encode JsonObject correctly
Version
Version 1.0.1
Context
Sending a simple JsonObject is encoded incorrectly via Jackson or Gson.
Reproducer
JsonObject json = new JsonObject().put("login", new JsonObject());
JsonCodec codec = new JacksonCodec();
String str = codec.encode(json);
Expected
str = "{"login": {}}"
Actual
str = {"map":{"login":{"map":{},"empty":true}},"empty":false}
Conclusion
The Jackson encoder implementation doesn't know how to encode a Map
correctly.
Suggested Solution
Replace:
io.vertx.eventbusclient.json.JsonCodec
with io.vertx.core.spi.json.JsonCodec
io.vertx.eventbusclient.json.JacksonCodec
with io.vertx.core.json.jackson.JacksonCodec
Implement a new GsonCodec in io.vertx.core.json