I am facing an issue while getting accessing the body of my http put request in Vert.x. The exception which I am getting is
. The same code works when I try it with postman. I am not able to figure it out what making it different when I request from my application.Â
2) then I try to get the body of my put requestÂ
JsonObject body = routingContext.getBodyAsJson();Â
This works when I call from postman but starts complaining when I try from my application.Â
My JSon object is a bit complex but it does not work if even I shorten the Json object.Â
My Json in body is
{
  "ani": "23452",
  "cdtd": 1,
  "fields": [
    [
      {
        "id": 1,
        "name": "firstname",
        "type": "text",
        "text": "First Name",
        "values": null,
        "agentid": null,
        "agentname": null,
        "peripheralid": null,
        "maxlength": 20,
        "columnright": false,
        "value": "adsf",
        "updateincallvariable": "adf"
      },
      {
        "id": 2,
        "name": "lastname",
        "type": "text",
        "text": "Last Name",
        "values": null,
        "agentid": null,
        "agentname": null,
        "peripheralid": null,
        "maxlength": 20,
        "columnright": false,
        "value": "asdfas",
        "updateincallvariable": "asdfa"
      }
    ],
    [
      {
        "id": 1,
        "name": "email",
        "type": "text",
        "text": "First Name",
        "values": null,
        "agentid": null,
        "agentname": null,
        "peripheralid": null,
        "maxlength": 20,
        "columnright": false,
        "value": "adsf",
        "updateincallvariable": "adf"
      },
      {
        "id": 2,
        "name": "phone",
        "type": "text",
        "text": "Last Name",
        "values": null,
        "agentid": null,
        "agentname": null,
        "peripheralid": null,
        "maxlength": 20,
        "columnright": false,
        "value": "asdfas",
        "updateincallvariable": "asdfa"
      }
    ]
  ]
}
This does not work even if I shorten my Json
{
"cdtd": 1,
"fields": "Nothing"
}
here is the full stack trace of exception,Â
Dez 03, 2018 4:13:46 PM io.vertx.ext.web.impl.RoutingContextImplBase
SEVERE: Unexpected exception in route
io.vertx.core.json.DecodeException: Failed to decode:Cannot deserialize instance of `java.util.LinkedHashMap` out of START_ARRAY token
 at [Source: (io.netty.buffer.ByteBufInputStream); line: 1, column: 1]
at io.vertx.core.json.Json.decodeValue(Json.java:168)
at io.vertx.core.json.JsonObject.fromBuffer(JsonObject.java:952)
at io.vertx.core.json.JsonObject.<init>(JsonObject.java:72)
at io.vertx.ext.web.impl.RoutingContextImpl.getBodyAsJson(RoutingContextImpl.java:257)
at io.vertx.reactivex.ext.web.RoutingContext.getBodyAsJson(RoutingContext.java:316)
at com.buchersuter.customerdetails.verticles.AgentVerticle.updateRecord(AgentVerticle.java:124)
at io.vertx.reactivex.ext.web.Route$1.handle(Route.java:155)
at io.vertx.reactivex.ext.web.Route$1.handle(Route.java:153)
at io.vertx.ext.web.impl.RouteImpl.handleContext(RouteImpl.java:225)
at io.vertx.ext.web.impl.RoutingContextImplBase.iterateNext(RoutingContextImplBase.java:85)
at io.vertx.ext.web.impl.RoutingContextImpl.next(RoutingContextImpl.java:133)
at io.vertx.reactivex.ext.web.RoutingContext.next(RoutingContext.java:128)
at com.buchersuter.customerdetails.verticles.AgentVerticle.checkSession(AgentVerticle.java:77)
at io.vertx.reactivex.ext.web.Route$1.handle(Route.java:155)
at io.vertx.reactivex.ext.web.Route$1.handle(Route.java:153)
at io.vertx.ext.web.impl.RouteImpl.handleContext(RouteImpl.java:225)
at io.vertx.ext.web.impl.RoutingContextImplBase.iterateNext(RoutingContextImplBase.java:120)
at io.vertx.ext.web.impl.RoutingContextImpl.next(RoutingContextImpl.java:133)
at io.vertx.ext.web.handler.impl.BodyHandlerImpl$BHandler.doEnd(BodyHandlerImpl.java:231)
at io.vertx.ext.web.handler.impl.BodyHandlerImpl$BHandler.end(BodyHandlerImpl.java:211)
at io.vertx.ext.web.handler.impl.BodyHandlerImpl.lambda$handle$0(BodyHandlerImpl.java:74)
at io.vertx.core.http.impl.HttpServerRequestImpl.handleEnd(HttpServerRequestImpl.java:417)
at io.vertx.core.http.impl.Http1xServerConnection.handleEnd(Http1xServerConnection.java:482)
at io.vertx.core.http.impl.Http1xServerConnection.handleContent(Http1xServerConnection.java:477)
at io.vertx.core.http.impl.Http1xServerConnection.processMessage(Http1xServerConnection.java:458)
at io.vertx.core.http.impl.Http1xServerConnection.handleMessage(Http1xServerConnection.java:144)
at io.vertx.core.http.impl.HttpServerImpl$ServerHandlerWithWebSockets.handleMessage(HttpServerImpl.java:728)
at io.vertx.core.http.impl.HttpServerImpl$ServerHandlerWithWebSockets.handleMessage(HttpServerImpl.java:619)
at io.vertx.core.net.impl.VertxHandler.lambda$channelRead$1(VertxHandler.java:146)
at io.vertx.core.impl.ContextImpl.lambda$wrapTask$2(ContextImpl.java:337)
at io.vertx.core.impl.ContextImpl.executeFromIO(ContextImpl.java:195)
at io.vertx.core.net.impl.VertxHandler.channelRead(VertxHandler.java:144)
at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:362)
at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:348)
at io.netty.channel.AbstractChannelHandlerContext.fireChannelRead(AbstractChannelHandlerContext.java:340)
at io.netty.handler.codec.ByteToMessageDecoder.fireChannelRead(ByteToMessageDecoder.java:310)
at io.netty.handler.codec.ByteToMessageDecoder.channelRead(ByteToMessageDecoder.java:284)
at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:362)
at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:348)
at io.netty.channel.AbstractChannelHandlerContext.fireChannelRead(AbstractChannelHandlerContext.java:340)
at io.netty.channel.DefaultChannelPipeline$HeadContext.channelRead(DefaultChannelPipeline.java:1359)
at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:362)
at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:348)
at io.netty.channel.DefaultChannelPipeline.fireChannelRead(DefaultChannelPipeline.java:935)
at io.netty.channel.nio.AbstractNioByteChannel$NioByteUnsafe.read(AbstractNioByteChannel.java:141)
at io.netty.channel.nio.NioEventLoop.processSelectedKey(NioEventLoop.java:645)
at io.netty.channel.nio.NioEventLoop.processSelectedKeysOptimized(NioEventLoop.java:580)
at io.netty.channel.nio.NioEventLoop.processSelectedKeys(NioEventLoop.java:497)
at io.netty.channel.nio.NioEventLoop.run(NioEventLoop.java:459)
at io.netty.util.concurrent.SingleThreadEventExecutor$5.run(SingleThreadEventExecutor.java:886)
at io.netty.util.concurrent.FastThreadLocalRunnable.run(FastThreadLocalRunnable.java:30)
at java.lang.Thread.run(Thread.java:748)
Caused by: com.fasterxml.jackson.databind.exc.MismatchedInputException: Cannot deserialize instance of `java.util.LinkedHashMap` out of START_ARRAY token
 at [Source: (io.netty.buffer.ByteBufInputStream); line: 1, column: 1]
at com.fasterxml.jackson.databind.exc.MismatchedInputException.from(MismatchedInputException.java:63)
at com.fasterxml.jackson.databind.DeserializationContext.reportInputMismatch(DeserializationContext.java:1342)
at com.fasterxml.jackson.databind.DeserializationContext.handleUnexpectedToken(DeserializationContext.java:1138)
at com.fasterxml.jackson.databind.DeserializationContext.handleUnexpectedToken(DeserializationContext.java:1092)
at com.fasterxml.jackson.databind.deser.std.StdDeserializer._deserializeFromEmpty(StdDeserializer.java:599)
at com.fasterxml.jackson.databind.deser.std.MapDeserializer.deserialize(MapDeserializer.java:360)
at com.fasterxml.jackson.databind.deser.std.MapDeserializer.deserialize(MapDeserializer.java:29)
at com.fasterxml.jackson.databind.ObjectMapper._readMapAndClose(ObjectMapper.java:4013)
at com.fasterxml.jackson.databind.ObjectMapper.readValue(ObjectMapper.java:3070)
at io.vertx.core.json.Json.decodeValue(Json.java:166)
... 51 more