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

JSON decoding of an objectid returns error

    • Type: Icon: Bug Bug
    • Resolution: Fixed
    • Priority: Icon: Major - P3 Major - P3
    • 0.0.16
    • Affects Version/s: 0.0.13
    • Component/s: BSON
    • None
    • Environment:
      Encountered in OSX and Linux but independent from any OS

      if an ObjectID is part of a struct and this struct gets marshalled into json it gets converted into an array of integers, which is in line with the specification for json marshalling for an array of bytes. When the bytes are umnarshalled calling json.Unmarshal, however, the objectid.UnmarshalJSON method is called, which errors cause of the following lines:

       
      m := make(map[string]string)
      err := json.Unmarshal(b, &m)
      if err != nil

      {     return err }

       
      from line 85 of bson/objectid/objectid.go

            Assignee:
            go-community-user Go Community User
            Reporter:
            ddanna79 Delio D'Anna
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

              Created:
              Updated:
              Resolved: