alibaba / alibaba/fastjson2

[QUESTION] 如何严格控制字符串类型的字段,必须有双引号

Open
#3,924 1 comment 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

{
"username": "testuser",
"password": "123456",
"email": "test@example.com",
"age": 25,
"transactionAmount": 111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111
}

transactionAmount 在java 类中定义的是string ,如何验证控制 传递的时候 transactionAmount 必须是字符串 双引号括起来的,这样可以 直接 readString(),不用 转成 bigdecimal 再转成 string 以防 bigdecimal 导致cpu 高

Contributor guide

Open the contributing guide

Research direction

Start with the Java field declaration for transactionAmount and the deserialization path that reads it. Determine how the parser distinguishes a quoted string from an unquoted numeric value and define the expected validation behavior, including whether readString() must reject the unquoted input; done means the behavior is specified and covered by a regression test.

Written by the indexing model from the issue text.

Assessment

Tech stack
java
Domain
backend
Issue type
Feature
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
30/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.