alibaba / alibaba/fastjson2

中文key转拼音key

Open
#2,428 3 comments 0 reactions 0 assignees View on GitHub
question
Dominant language
Java
Stars
4.4k
Forks
613
Avg merge
1d 22h
Merged PRs (30d)
6

Description

大佬:我现在有个大json数据,里面有很多层级,大json数据里面的key全部都是中文的,现在需求是需要把里面的中文key快速变成拼音key,且能保持原有中文key的一些顺序,有什么好的办法吗??

比如:
[
{
"姓名":"张三",
"年龄":"8岁"
},
{
"姓名":"李四",
"年龄":"9岁"
}
]

转化后为:
[
{
"xm":"张三",
"nl":"8岁"
},
{
"xm":"李四",
"nl":"9岁"
}
]

Contributor guide

Open the contributing guide

Research direction

The issue describes recursively converting Chinese JSON keys to pinyin keys while preserving their order, with an example, but names no files, tests, or entry points. Start by locating the JSON key transformation or serialization APIs; done means the nested example converts consistently to pinyin keys without changing key order.

Written by the indexing model from the issue text.

Assessment

Tech stack
java
Domain
data
Issue type
Feature
Difficulty
5/5
Estimated time
Over a week
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
20/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.