Skip to content

Formatting of Unicode-encoded characters leads to broken JSON output #6

Description

@jabrandes-bscm

When having a JSON string as input, i.e. from an API response in Bruno, it seems that unicode-encoded characters from embedded JSON content in string fields are decoded in the final formatted JSON, which may lead to the output of invalid JSON that fails proper parsing.

Tested with Version: 0.4.0

Example:

A JSON-string of the form:

{
    "myEmbeddedJson": "{\u0022embeddedField\u0022:\u0022embeddedValue\u0022}"
}

Current Output:

{
    "myEmbeddedJson": "{"embeddedField":"embeddedValue"}"
}

(Note the previously encoded quotes from the embedded JSON now being unencoded first-level quotes.)

Expected Output:

Either:

  • same as example input (resembles the input more closely if existing escape-sequences are kept as-is)
  • with Unicode-encoded characters replaced by their respective direct escape-sequences, if defined (i.e. \u0022 to \", see RFC-38259, Section 7; example output below)
{
    "myEmbeddedJson": "{\"embeddedField\":\"embeddedValue\"}"
}

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

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