Skip to content

[BUG] 在处理 Map 对象反序列化时,没有严格按照 JSON 标准把 Long 的 key 加引号。 #3952

@sunrui

Description

@sunrui

根据 RFC 7159(JSON 标准),JSON 对象的 key 必须是字符串类型。

// 代码示例

Map<Long, String> map = new HashMap<>();
map.put(123456789012345678L, "value");
System.out.println(JSON.toJSONString(largeLongKeyMap));

// FastJSON2 输出
{123456789012345678:"value"}

// 标准 JSON 输出
{"123456789012345678":"value"}

测试版本 2.0.43

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions