Skip to content

Not have httpjson always render pretty-formatted JSON #5881

@GCrispino

Description

@GCrispino

What problem does your feature solve?

Can possibly save a lot in data size when rendering JSON, more specifically, when rendering responses for the Horizon API.

What would you like to see?

Currently, the httpjson package renders JSON API output data by ultimately calling its RenderStatus function, which always calls the renderToString function setting true as the value of the pretty parameter.

My suggestion is to have the renderToString be called with false as the default value, which will probably be more efficient when consuming JSON data from the API if we don't need pretty JSON data.
A nice-to-have would be to have a query parameter or something like that in Horizon which we could use to control the value that's passed to the pretty param of the renderToString function.

If that's of any interest, I've implemented a POC (don't know if this breaks anything) of this in my local fork, see this commit: GCrispino@2f30939

What alternatives are there?

None, to the best of my knowledge.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions