Skip to content
This repository has been archived by the owner on Jul 10, 2024. It is now read-only.

Discard control characters when parsing JSON #165

Merged
merged 6 commits into from
Oct 21, 2022
Merged

Conversation

thatplguy
Copy link
Contributor

The Go JSON parser rejects JSON strings that contain control characters (U+0000

  • U+001F). We'd like to be more permissive. Rather than implementing our own parser, this PR adds a preprocessing step that removes unescaped control characters before invoking Go's JSON parser.

The Go JSON parser rejects JSON strings that contain control characters (U+0000
- U+001F).  We'd like to be more permissive.  Rather than implementing our own
parser, this PR adds a preprocessing step that removes unescaped control
characters before invoking Go's JSON parser.
@thatplguy thatplguy requested review from liujed and mgritter October 20, 2022 01:55
learn/json_preprocessor.go Outdated Show resolved Hide resolved
learn/json_preprocessor.go Outdated Show resolved Hide resolved
learn/json_preprocessor.go Outdated Show resolved Hide resolved
learn/json_preprocessor.go Show resolved Hide resolved
@thatplguy thatplguy requested review from liujed and mgritter October 20, 2022 03:10
learn/json_preprocessor.go Outdated Show resolved Hide resolved
learn/json_preprocessor.go Outdated Show resolved Hide resolved
learn/json_preprocessor.go Outdated Show resolved Hide resolved
learn/json_preprocessor.go Outdated Show resolved Hide resolved
learn/json_preprocessor.go Outdated Show resolved Hide resolved
learn/json_preprocessor.go Outdated Show resolved Hide resolved
@thatplguy thatplguy merged commit 6546a0d into main Oct 21, 2022
@thatplguy thatplguy deleted the cns/control-chars branch October 21, 2022 01:02
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants