internal/json: replace segmentio/encoding with encoding/json/v2 - #1287
Open
nahapetyan-serob wants to merge 5 commits into
Open
nahapetyan-serob wants to merge 5 commits into
nahapetyan-serob wants to merge 5 commits into
Conversation
nahapetyan-serob
force-pushed
the
serob/use-encoding-json-v2
branch
from
September 23, 2026 09:14
5818f09 to
d0941b2
Compare
| return err | ||
| } | ||
| return NewDecoder(bytes.NewReader(data)).Decode(v) | ||
| return jsonv2.Unmarshal(data, v, caseSensitiveV1) |
Contributor
There was a problem hiding this comment.
why not using the Decoder also in this case? In this way the behavior is 100% not changed
Author
There was a problem hiding this comment.
Right. Will go back to using the Decoder.
…rotocol/go-sdk into serob/use-encoding-json-v2
guglielmo-san
approved these changes
Sep 25, 2026
This branch has not been deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
segmentio/encodingwas added in #807 for one method:DontMatchCaseInsensitiveStructFields(). Thejson/v2API does strict field-name matching natively, so the dependency isn't needed.Behavior is unchanged.
DefaultOptionsV1()keeps all v1 semantics — duplicate names permitted, invalid UTF-8 replaced, v1 null/merge handling, any-length arrays — andMatchCaseInsensitiveNames(false)overrides the one we don't want. No v2 strictness is adopted here.internal/json/json_test.gois untouched and passes as-is.UnmarshalUseNumber stays on the v1 decoder and remains case-insensitive: no public API combines UseNumber with strict matching.
go-json-experiment/jsonhosts a mirror ofencoding/json/v2with thegoexperiment.jsonv2build tag (which is enabled by default on Go 1.27)Breaking: go.mod goes 1.25.0 → 1.26 (the dependency declares it); Go 1.25 is no longer supported. CI matrix ["1.25","1.26"] → ["1.26","1.27"], which also covers both of the dependency's build paths.