Skip to content

encoding/json: make Number with the ,string option marshal with quotes#34269

Closed
breml wants to merge 1 commit intogolang:masterfrom
breml:fix-json-number-string-option
Closed

encoding/json: make Number with the ,string option marshal with quotes#34269
breml wants to merge 1 commit intogolang:masterfrom
breml:fix-json-number-string-option

Conversation

@breml
Copy link
Copy Markdown
Contributor

@breml breml commented Sep 12, 2019

Add quotes when marshaling a json.Number with the string option
set via a struct tag. This ensures that the resulting json
can be unmarshaled into the source struct without error.

Fixes #34268

Add quotes if a value of type json.Number with the string option
(struct tag) set is marshaled. This ensures, that the resulting json
can be unmarshaled into the source struct without error.

Fixes golang#34268
@googlebot googlebot added the cla: yes Used by googlebot to label PRs as having a valid CLA. The text of this label should not change. label Sep 12, 2019
@gopherbot
Copy link
Copy Markdown
Contributor

This PR (HEAD: dde81b7) has been imported to Gerrit for code review.

Please visit https://go-review.googlesource.com/c/go/+/195043 to see it.

Tip: You can toggle comments from me using the comments slash command (e.g. /comments off)
See the Wiki page for more info

@gopherbot
Copy link
Copy Markdown
Contributor

Message from Daniel Martí:

Patch Set 1: Run-TryBot+1

(4 comments)

The roundtrip argument makes sense, and the fix looks good. Just some minor thoughts.


Please don’t reply on this GitHub thread. Visit golang.org/cl/195043.
After addressing review feedback, remember to publish your drafts!

@gopherbot
Copy link
Copy Markdown
Contributor

Message from Gobot Gobot:

Patch Set 1:

TryBots beginning. Status page: https://farmer.golang.org/try?commit=d49134af


Please don’t reply on this GitHub thread. Visit golang.org/cl/195043.
After addressing review feedback, remember to publish your drafts!

@gopherbot
Copy link
Copy Markdown
Contributor

Message from Gobot Gobot:

Patch Set 1: TryBot-Result+1

TryBots are happy.


Please don’t reply on this GitHub thread. Visit golang.org/cl/195043.
After addressing review feedback, remember to publish your drafts!

@breml breml changed the title encoding/json: fix marshal for json.Number ,string encoding/json: make Number with the ,string option marshal with quotes Sep 13, 2019
@gopherbot
Copy link
Copy Markdown
Contributor

Message from Lucas Bremgartner:

Patch Set 3:

(4 comments)

Thanks Daniel for the review, I changed the commit message according to your suggestions.


Please don’t reply on this GitHub thread. Visit golang.org/cl/195043.
After addressing review feedback, remember to publish your drafts!

@gopherbot
Copy link
Copy Markdown
Contributor

Message from Daniel Martí:

Patch Set 3: Run-TryBot+1 Code-Review+2

(1 comment)


Please don’t reply on this GitHub thread. Visit golang.org/cl/195043.
After addressing review feedback, remember to publish your drafts!

@gopherbot
Copy link
Copy Markdown
Contributor

Message from Gobot Gobot:

Patch Set 3:

TryBots beginning. Status page: https://farmer.golang.org/try?commit=128457ce


Please don’t reply on this GitHub thread. Visit golang.org/cl/195043.
After addressing review feedback, remember to publish your drafts!

@gopherbot
Copy link
Copy Markdown
Contributor

Message from Gobot Gobot:

Patch Set 3: TryBot-Result+1

TryBots are happy.


Please don’t reply on this GitHub thread. Visit golang.org/cl/195043.
After addressing review feedback, remember to publish your drafts!

gopherbot pushed a commit that referenced this pull request Sep 16, 2019
Add quotes when marshaling a json.Number with the string option
set via a struct tag. This ensures that the resulting json
can be unmarshaled into the source struct without error.

Fixes #34268

Change-Id: Ide167d9dec77019554870b5957b37dc258119d81
GitHub-Last-Rev: dde81b7
GitHub-Pull-Request: #34269
Reviewed-on: https://go-review.googlesource.com/c/go/+/195043
Reviewed-by: Daniel Martí <mvdan@mvdan.cc>
Run-TryBot: Daniel Martí <mvdan@mvdan.cc>
TryBot-Result: Gobot Gobot <gobot@golang.org>
@gopherbot
Copy link
Copy Markdown
Contributor

This PR is being closed because golang.org/cl/195043 has been merged.

@gopherbot gopherbot closed this Sep 16, 2019
@breml breml deleted the fix-json-number-string-option branch September 16, 2019 18:46
q3k pushed a commit to q3k/cursedjson that referenced this pull request Sep 26, 2019
Add quotes when marshaling a json.Number with the string option
set via a struct tag. This ensures that the resulting json
can be unmarshaled into the source struct without error.

Fixes #34268

Change-Id: Ide167d9dec77019554870b5957b37dc258119d81
GitHub-Last-Rev: dde81b71208be01c253bb87dbb6f81ac6e0785be
GitHub-Pull-Request: golang/go#34269
Reviewed-on: https://go-review.googlesource.com/c/go/+/195043
Reviewed-by: Daniel Martí <mvdan@mvdan.cc>
Run-TryBot: Daniel Martí <mvdan@mvdan.cc>
TryBot-Result: Gobot Gobot <gobot@golang.org>
e-nikolov pushed a commit to e-nikolov/json that referenced this pull request Nov 25, 2021
Add quotes when marshaling a json.Number with the string option
set via a struct tag. This ensures that the resulting json
can be unmarshaled into the source struct without error.

Fixes #34268

Change-Id: Ide167d9dec77019554870b5957b37dc258119d81
GitHub-Last-Rev: dde81b71208be01c253bb87dbb6f81ac6e0785be
GitHub-Pull-Request: golang/go#34269
Reviewed-on: https://go-review.googlesource.com/c/go/+/195043
Reviewed-by: Daniel Martí <mvdan@mvdan.cc>
Run-TryBot: Daniel Martí <mvdan@mvdan.cc>
TryBot-Result: Gobot Gobot <gobot@golang.org>
e-nikolov pushed a commit to e-nikolov/json that referenced this pull request Nov 25, 2021
Add quotes when marshaling a json.Number with the string option
set via a struct tag. This ensures that the resulting json
can be unmarshaled into the source struct without error.

Fixes #34268

Change-Id: Ide167d9dec77019554870b5957b37dc258119d81
GitHub-Last-Rev: dde81b71208be01c253bb87dbb6f81ac6e0785be
GitHub-Pull-Request: golang/go#34269
Reviewed-on: https://go-review.googlesource.com/c/go/+/195043
Reviewed-by: Daniel Martí <mvdan@mvdan.cc>
Run-TryBot: Daniel Martí <mvdan@mvdan.cc>
TryBot-Result: Gobot Gobot <gobot@golang.org>
e-nikolov pushed a commit to e-nikolov/json that referenced this pull request Nov 25, 2021
Add quotes when marshaling a json.Number with the string option
set via a struct tag. This ensures that the resulting json
can be unmarshaled into the source struct without error.

Fixes #34268

Change-Id: Ide167d9dec77019554870b5957b37dc258119d81
GitHub-Last-Rev: dde81b71208be01c253bb87dbb6f81ac6e0785be
GitHub-Pull-Request: golang/go#34269
Reviewed-on: https://go-review.googlesource.com/c/go/+/195043
Reviewed-by: Daniel Martí <mvdan@mvdan.cc>
Run-TryBot: Daniel Martí <mvdan@mvdan.cc>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

cla: yes Used by googlebot to label PRs as having a valid CLA. The text of this label should not change.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

encoding/json: wrong encoding for json.Number field with string option (struct tag)

3 participants