Skip to content

[BUG]BigDecimal用JSONB反序列化时报错 #2954

@deadpoolssr

Description

@deadpoolssr

问题描述

BigDecimal用JSONB反序列化时报错

环境信息

请填写以下信息:
fastjson2版本:2.0.53_preview01
报错:
com.alibaba.fastjson2.JSONException: readInt32Value not support INT64 -56, offset 4/4

at com.alibaba.fastjson2.JSONBDump.readInt32Value(JSONBDump.java:637)
at com.alibaba.fastjson2.JSONBDump.dumpAny(JSONBDump.java:278)
at com.alibaba.fastjson2.JSONBDump.<init>(JSONBDump.java:45)
at com.alibaba.fastjson2.JSONB.toJSONString(JSONB.java:1288)

重现步骤

单测可以复现

  1. 使用 xxx.xxx 方法
  2. 输入 ... 数据
  3. 出现 ... 错误
    @Test
    public void testB() {

        BigDecimal numberInText2 = new BigDecimal("20.0");
        byte[] bytes = com.alibaba.fastjson2.JSONB.toBytes(numberInText2);
        String jsonString = com.alibaba.fastjson2.JSONB.toJSONString(bytes);
    }

Metadata

Metadata

Assignees

Labels

bugSomething isn't workingfixed

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions