Skip to content

How to disable HTML escaping? #362

Open
@mattjohnsonpint

Description

@mattjohnsonpint

It seems that gjson.AppendJsonString always escapes HTML characters.

gjson/gjson.go

Lines 1943 to 1945 in c2bc5a4

} else if s[i] == '>' || s[i] == '<' || s[i] == '&' {
dst = append(dst, '\\', 'u')
dst = appendHex16(dst, uint16(s[i]))

Can we get an option to disable that for non-HTML scenarios?

There is precedent with other encoders:

Thanks.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions