Uploaded image for project: 'Go Driver'
  1. Go Driver
  2. GODRIVER-703

UnmarshalExtJSON cannot decode null into a string type

    XMLWordPrintableJSON

Details

    • Icon: Bug Bug
    • Resolution: Works as Designed
    • Icon: Major - P3 Major - P3
    • None
    • No Release
    • BSON
    • None
    • go 1.11.1

    Description

      type User struct {
          B string `bson:"b"`
          C string `bson:"c,omitempty"` 
      }
       
      func Test_UnmarshalB(t *testing.T) {
           payload := `{"c": null, "b": "b"}`
           internal := User{}
           err := bson.UnmarshalExtJSON([]byte(payload), false, &internal)
           t.Errorf("%#v %v", internal, err)
      }
      

      >>>   mgdbugs.User{B:"", C:""} cannot decode null into a string type

      Attachments

        Activity

          People

            Unassigned Unassigned
            exfly exfly
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: