Jersey: Json array with 1 element is serialized as object

前端 未结 8 2168
眼角桃花
眼角桃花 2021-01-03 19:20

I\'m creating a REST server with Jersey/Java and I found a strange behavior.

I have a method on the server that returns an array of objects as Json

@         


        
8条回答
  •  半阙折子戏
    2021-01-03 19:55

    You could also try Genson library http://code.google.com/p/genson/. It integrates well with jersey, just drop the jar in your classpath and everything will work. It doesnt require you to write additional code, it should work like what you have now but without any weird result.

提交回复
热议问题