Rietveld Code Review Tool
Help | Bug tracker | Discussion group | Source code | Sign in
(934)

Issue 6759043: code review 6759043: json.Unmarshal: convert nulls to zero values (Closed)

Can't Edit
Can't Publish+Mail
Start Review
Created:
7 years, 8 months ago by rick
Modified:
7 years, 8 months ago
Reviewers:
CC:
rsc, golang-dev
Visibility:
Public.

Description

json.Unmarshal: convert nulls to zero values As discussed in issue 2540, nulls are allowed for any type in JSON so they should not result in an error during Unmarshal. Fixes issue 2540.

Patch Set 1 #

Patch Set 2 : diff -r 6653eb72fd46 https://code.google.com/p/go #

Patch Set 3 : diff -r 6653eb72fd46 https://code.google.com/p/go #

Total comments: 1

Patch Set 4 : diff -r a2f1842353e7 https://code.google.com/p/go #

Unified diffs Side-by-side diffs Delta from patch set Stats (+48 lines, -3 lines) Patch
M src/pkg/encoding/json/decode.go View 1 2 3 1 chunk +1 line, -3 lines 0 comments Download
M src/pkg/encoding/json/decode_test.go View 1 2 3 1 chunk +47 lines, -0 lines 0 comments Download

Messages

Total messages: 7
rick
Hello golang-dev@googlegroups.com, I'd like you to review this change to https://code.google.com/p/go
7 years, 8 months ago (2012-10-24 01:43:57 UTC) #1
rsc
https://codereview.appspot.com/6759043/diff/3003/src/pkg/encoding/json/decode.go File src/pkg/encoding/json/decode.go (right): https://codereview.appspot.com/6759043/diff/3003/src/pkg/encoding/json/decode.go#newcode619 src/pkg/encoding/json/decode.go:619: v.Set(reflect.Zero(v.Type())) I think the old code should stay; just ...
7 years, 8 months ago (2012-11-01 16:41:57 UTC) #2
rsc
Also please update the test to verify that null does not zero values of non-reference ...
7 years, 8 months ago (2012-11-01 16:42:39 UTC) #3
rick
Hello rsc@golang.org (cc: golang-dev@googlegroups.com), Please take another look.
7 years, 8 months ago (2012-11-02 01:00:08 UTC) #4
rick
Done. PTAL On Thursday, November 1, 2012 12:42:39 PM UTC-4, rsc wrote: > > Also ...
7 years, 8 months ago (2012-11-04 20:59:06 UTC) #5
rsc
LGTM
7 years, 8 months ago (2012-11-12 20:17:39 UTC) #6
rsc
7 years, 8 months ago (2012-11-12 20:35:14 UTC) #7
*** Submitted as http://code.google.com/p/go/source/detail?r=9a07c3da6c44 ***

encoding/json: skip unexpected null values

As discussed in issue 2540, nulls are allowed for any type in JSON so they
should not result in an error during Unmarshal.
Fixes issue 2540.

R=rsc
CC=golang-dev
http://codereview.appspot.com/6759043

Committer: Russ Cox <rsc@golang.org>
Sign in to reply to this message.

Powered by Google App Engine
RSS Feeds Recent Issues | This issue
This is Rietveld f62528b