{"action":"opened","issue":{"url":"https://api.github.com/repos/uber-go/zap/issues/81","repository_url":"https://api.github.com/repos/uber-go/zap","labels_url":"https://api.github.com/repos/uber-go/zap/issues/81/labels{/name}","comments_url":"https://api.github.com/repos/uber-go/zap/issues/81/comments","events_url":"https://api.github.com/repos/uber-go/zap/issues/81/events","html_url":"https://github.com/uber-go/zap/issues/81","id":160679826,"number":81,"title":"jsonEncoder and duplicate keys","user":{"login":"campbellr","id":205752,"avatar_url":"https://avatars.githubusercontent.com/u/205752?v=3","gravatar_id":"","url":"https://api.github.com/users/campbellr","html_url":"https://github.com/campbellr","followers_url":"https://api.github.com/users/campbellr/followers","following_url":"https://api.github.com/users/campbellr/following{/other_user}","gists_url":"https://api.github.com/users/campbellr/gists{/gist_id}","starred_url":"https://api.github.com/users/campbellr/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/campbellr/subscriptions","organizations_url":"https://api.github.com/users/campbellr/orgs","repos_url":"https://api.github.com/users/campbellr/repos","events_url":"https://api.github.com/users/campbellr/events{/privacy}","received_events_url":"https://api.github.com/users/campbellr/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":0,"created_at":"2016-06-16T14:45:03Z","updated_at":"2016-06-16T14:45:03Z","closed_at":null,"body":"I noticed that if I do something like this:\r\n\r\n```go\r\nlogger := zap.NewJSON()\r\nlogger.Info(\"dupe fields\", zap.String(\"foo\", \"bar\"), zap.String(\"foo\", \"baz\"))\r\n```\r\n\r\nI end up getting a JSON record like this:\r\n\r\n```json\r\n{\"msg\":\"dupe fields\",\"level\":\"info\",\"ts\":1466086541235126983,\"fields\":{\"foo\":\"bar\",\"foo\":\"baz\"}}\r\n```\r\n\r\nNow, the above example probably doesn't make a lot of sense, but it is more realistic if you consider an application that passes loggers around, with various layers adding context with \"zap.Logger.With`.\r\n\r\nI can't find anything that says duplicate fields are against the spec, and it doesn't seem to break `json.Unmarshal` or Python's `json.loads` which both end up taking the last `\"foo\":\"baz\"`, but it still might be worth handling (or even just documenting)."}}
{"actor":{"display_login":"campbellr"}}