Skip to content

Encoder produces broken output for strings starting with a single quote that require escaping #68

Description

@Aquilosion

When encoding a string that:

  • Requires escaping (e.g. contains a backslash)
  • Starts with a single quote

…the stringifier emits a broken multiline token that cannot be parsed back.

Example input:

const Hjson = require('hjson');

const obj = {
    "test": "'Hello,\\nWorld!'"
};

console.log(Hjson.stringify(obj));

Produces this broken output:

{
  test: ''''Hello,\nWorld!''''
}

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Fields

    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions