From 25a33daa2b7e7bda773705215113450923ae4815 Mon Sep 17 00:00:00 2001 From: Sean Liao Date: Thu, 21 May 2020 17:52:33 +0200 Subject: encoding/json: allow semicolon in field key / struct tag MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Allow ';' as a valid character for json field keys and struct tags. Fixes #39189 Change-Id: I4b602a1b0674ff028db07623682f0d1e8e9fd6c9 Reviewed-on: https://go-review.googlesource.com/c/go/+/234818 Run-TryBot: Daniel Martí TryBot-Result: Go Bot Trust: Giovanni Bajo Trust: Daniel Martí Reviewed-by: Daniel Martí --- src/encoding/json/encode.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src/encoding/json/encode.go') diff --git a/src/encoding/json/encode.go b/src/encoding/json/encode.go index 578d551102..c2d191442c 100644 --- a/src/encoding/json/encode.go +++ b/src/encoding/json/encode.go @@ -946,7 +946,7 @@ func isValidTag(s string) bool { } for _, c := range s { switch { - case strings.ContainsRune("!#$%&()*+-./:<=>?@[]^_{|}~ ", c): + case strings.ContainsRune("!#$%&()*+-./:;<=>?@[]^_{|}~ ", c): // Backslash and quote chars are reserved, but // otherwise any punctuation chars are allowed // in a tag name. -- cgit v1.3