Skip to content

encoding/json: document that Encoder.Encode produces JSON values as single text line #67943

Closed
@dolmen

Description

@dolmen

Proposal Details

The encoding/json Encoder outputs JSON values as single lines of text since its original version and this is a design choice (see @rsc claim). This makes it an early implementation of the JSON Lines standard.

However this feature is undocumented: nothing about the absence of \n in doc for Encoder, Encoder.Encode (or json.Marshal). As this is undocumented, users can't rely on this implementation detail (but I expect many rely on it anyway).

This proposal is about extending the Encoder.Encode documentation to guarantee that no raw \n or \r is produced inside a JSON value.

Metadata

Metadata

Assignees

No one assigned

    Labels

    DocumentationIssues describing a change to documentation.NeedsFixThe path to resolution is known, but the work has not been done.

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions