Skip to content

Add encoder formatting options: integerGrouping, trailingComma, dottedKeys#19

Merged
dereuromark merged 1 commit into
masterfrom
encoder-formatting-options
Mar 30, 2026
Merged

Add encoder formatting options: integerGrouping, trailingComma, dottedKeys#19
dereuromark merged 1 commit into
masterfrom
encoder-formatting-options

Conversation

@dereuromark
Copy link
Copy Markdown
Contributor

@dereuromark dereuromark commented Mar 30, 2026

Summary

Adds new EncoderOptions for controlling output formatting:

  • integerGrouping: Format large integers with underscores for readability (1_000_000 instead of 1000000)
  • trailingComma: Add trailing commas to arrays ([1, 2, 3,]) - useful for cleaner git diffs
  • dottedKeys: Use dotted key syntax instead of table headers (a.b.c = 1 instead of [a.b]\nc = 1)

All options default to false, preserving existing behavior.

Usage

$encoder = new Encoder(new EncoderOptions(
    integerGrouping: true,
    trailingComma: true,
    dottedKeys: true,
));

Notes

  • dottedKeys still uses [[table]] syntax for arrays of tables (dotted keys can't represent them)
  • All new options are thoroughly tested

…dKeys

New EncoderOptions:
- integerGrouping: Format large integers with underscores (1_000_000)
- trailingComma: Add trailing commas to arrays ([1, 2, 3,])
- dottedKeys: Use dotted key syntax instead of table headers (a.b.c = 1)

All options default to false, preserving existing behavior.
@dereuromark dereuromark merged commit ea1cc0f into master Mar 30, 2026
3 checks passed
@dereuromark dereuromark deleted the encoder-formatting-options branch March 30, 2026 20:45
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