Skip to content

Change default JSON serialization to compact wherever applicable#3633

Merged
lminiero merged 1 commit intomasterfrom
compact-json
Apr 13, 2026
Merged

Change default JSON serialization to compact wherever applicable#3633
lminiero merged 1 commit intomasterfrom
compact-json

Conversation

@lminiero
Copy link
Copy Markdown
Member

As the title says, this PR changes the default serialization we do of JSON objects to strings to compact, where before it was a pretty JSON with an indentation of 3. The discussion in OpenSIPS/opensips#3840 made me realize it made little sense for the default being a pretty indentation, considering that it's almost always meant to just be for exchanging API messages, rather than something that needs to be consumed by a human (but even in that case, prettifying it after received is always an option). Compact messages also means less data on the wire, so this should be considered an optimization.

This shouldn't impact any existing application, so I plan to merge soon. If for any reason you need indented JSON, remember it's always possible to change the default in the associated configuration file.

@JanFellner
Copy link
Copy Markdown
Contributor

JanFellner commented Apr 10, 2026

Can't check the code from here (in this hell crowd of ppl in Garda land :))

For developing purposes it's always handy to have it readable in the logs. --So asking if I would make sense to have it configurable.-- did not read to the end like always :)) so forget about it.

Defaulting to not pretty printed. On our side we do development builds using readable data and release builds compact.

@lminiero
Copy link
Copy Markdown
Member Author

did not read to the end like always :)) so forget about it

No worries, enjoy Gardaland! 😄

@lminiero lminiero merged commit 766420f into master Apr 13, 2026
8 checks passed
@lminiero lminiero deleted the compact-json branch April 13, 2026 15:34
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.

2 participants