Skip to content

Option to omit space between array elements #346

Closed
@felixfbecker

Description

@felixfbecker

We like to encode objects and arrays to query parameters using YAML. The parser is able to parse this correctly:

image

But unfortunately, the dumper always adds unneeded spaces between array elements:

image

We don't encode [] for prettiness and browsers can handle them fine (PHP has used them forever), but spaces of course do need to be encoded, which is not very pretty.

Here are the options I am currently using to output single line YAML:

yaml.safeDump(value, { flowLevel: 0, indent: 0, lineWidth: Infinity, noCompatMode: true, sortKeys: true })

It would be great to have an option for omitting these non-required spaces / emitting "minimized" YAML.

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