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

Bad JSONFormat rendering of nested records #13138

Closed
lukaseder opened this issue Feb 24, 2022 · 3 comments
Closed

Bad JSONFormat rendering of nested records #13138

lukaseder opened this issue Feb 24, 2022 · 3 comments

Comments

@lukaseder
Copy link
Member

The generation of formatted JSON results from result.formatJSON(new JSONFormat().format(true)) is off. E.g. this:

Result<Record2<String, Record2<String, String>>> result =
    create.newResult(FIELD_NAME1, rowField(row(FIELD_NAME1, FIELD_NAME2)));

result.add(record("a", record("b", "c")));
result.add(record("x", record("y", "z")));

Should produce something like this:

[
  [
    "a",
    [
      "b",
      "c"
    ]
  ],
  [
    "x",
    [
      "y",
      "z"
    ]
  ]
]

But instead produces

[
  [
    "a",
        [
      "b",
      "c"
    ]
  ],
  [
    "x",
        [
      "y",
      "z"
    ]
  ]
]

Looks like the indentations are off.

@lukaseder
Copy link
Member Author

Both record layouts are affected: arrays and objects.

@lukaseder
Copy link
Member Author

The implementation of #7782 is wrong. Our tests seem to have covered only unformatted output, which is correct.

@lukaseder
Copy link
Member Author

Fixed in jOOQ 3.17.0, 3.16.5 (#13140), and 3.15.9 (#13141)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant