Skip to content

[BUG] Exception on parsing object key with emoji and escape character #3928

@raipc

Description

@raipc

Problem

Exception on parsing of JSON object with emoji and escape character in key

Unit test

Map<String, String> map = Map.of("\uD83D\uDE07\\", "");
byte[] jsonBytes = JSON.toJSONBytes(map, StandardCharsets.UTF_8);
assertEquals(map, JSON.parseObject(jsonBytes, Map.class));

Now this code throws com.alibaba.fastjson2.JSONException: malformed input around byte 2.

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't workingfixed

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions