Skip to content

fix(remote): pretty JSON keeps its structural newlines - #136

Closed
colangelo wants to merge 1 commit into
masterfrom
fix/json-pretty-newline
Closed

colangelo wants to merge 1 commit into
masterfrom
fix/json-pretty-newline

Conversation

@colangelo

Copy link
Copy Markdown
Owner

Summary

Since 0.15.1, herdr-max machine list --json and machine status --json print invalid JSON: every structural line break of serde's pretty output came out as \u000a outside any string.

 escape_json(text)
-  escape every hidden char, '\n' included
+  escape every hidden char except '\n' (a raw newline in serde's output is always structural)

Hidden characters inside strings are still escaped (serde writes a newline inside a string as \n text, so it never reaches this path raw).

Evidence

  • Before: machine list --json | jq . failed to parse.
  • After: test pretty_json_keeps_its_line_breaks_and_parses_back parses the output back; just check green (6171 passed).

Merge Danger

Door: two-way

Blast Radius: CLI JSON output of machine commands

refs https://gitea.cat-bluegill.ts.net/AC-forks/herdr-max/issues/406

machine list --json and machine status --json printed every line break
of serde's pretty output as \u000a outside any string, so no JSON parser
read them. A raw newline in serde's output is always structural, so
escape_json leaves it; hidden characters inside strings are still escaped.

refs https://gitea.cat-bluegill.ts.net/AC-forks/herdr-max/issues/406
Work-Ref: WORK-05
@colangelo

Copy link
Copy Markdown
Owner Author

Landed on master after all-green CI and a passing just check.

@colangelo colangelo closed this Nov 29, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant