Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[BUG] PrettyFormat error #2974

Open
FantaZZ opened this issue Sep 19, 2024 · 0 comments
Open

[BUG] PrettyFormat error #2974

FantaZZ opened this issue Sep 19, 2024 · 0 comments
Labels
bug Something isn't working

Comments

@FantaZZ
Copy link

FantaZZ commented Sep 19, 2024

问题描述

PrettyFormat error

环境信息

请填写以下信息:

  • OS信息: macOS 15.0
  • JDK信息: Zulu21.34+19-CA (build 21.0.3+9-LTS)
  • 版本信息:Fastjson2 2.0.53

重现步骤

record Person (String name) {}

public static void main(String[] args) throws JSONException {
    var p = new Person("foo");
    System.out.println(JSON.toJSONString(p, JSONWriter.Feature.PrettyFormat));

    var jo = new JSONObject();
    jo.put("name", "foo");
    System.out.println(JSON.toJSONString(jo, JSONWriter.Feature.PrettyFormat));
}
{
	"name":"foo"
}
{
	
}

期待的正确结果

{
	"name":"foo"
}
{
	"name":"foo"
}
@FantaZZ FantaZZ added the bug Something isn't working label Sep 19, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

1 participant