且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

JSON解析错误:无法从START_OBJECT令牌中反序列化"byte []"实例

更新时间:2021-07-11 17:19:10

请求json的具体布局取决于JAX-RS框架的配置,但默认情况下,它是不带包装的普通JSON对象.在您的情况下,我将发送以下JSON:

The concrete layout of the request json depends on the configuration of the JAX-RS framework, but by default it is a plain JSON object without a wrapper. In your case, I would send this JSON:

{
   "userId": "arun0009", 
   "extension": ".png",    
   "text": null,
   "image": "BASE_64_ENCODED_IMAGE"
}

java端已经知道"期望的对象,因此添加的包装器不是必需的,并且(如您所注意到的)添加无效.

The java side already "knows" what object to expect, so the wrapper you added is not necessary and (as you noticed) not valid to add.