{"action":"closed","issue":{"url":"https://api.github.com/repos/buger/jsonparser/issues/57","repository_url":"https://api.github.com/repos/buger/jsonparser","labels_url":"https://api.github.com/repos/buger/jsonparser/issues/57/labels{/name}","comments_url":"https://api.github.com/repos/buger/jsonparser/issues/57/comments","events_url":"https://api.github.com/repos/buger/jsonparser/issues/57/events","html_url":"https://github.com/buger/jsonparser/issues/57","id":166539081,"number":57,"title":"EachKey can miss keys","user":{"login":"nieksand","id":1396037,"avatar_url":"https://avatars.githubusercontent.com/u/1396037?v=3","gravatar_id":"","url":"https://api.github.com/users/nieksand","html_url":"https://github.com/nieksand","followers_url":"https://api.github.com/users/nieksand/followers","following_url":"https://api.github.com/users/nieksand/following{/other_user}","gists_url":"https://api.github.com/users/nieksand/gists{/gist_id}","starred_url":"https://api.github.com/users/nieksand/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/nieksand/subscriptions","organizations_url":"https://api.github.com/users/nieksand/orgs","repos_url":"https://api.github.com/users/nieksand/repos","events_url":"https://api.github.com/users/nieksand/events{/privacy}","received_events_url":"https://api.github.com/users/nieksand/received_events","type":"User","site_admin":false},"labels":[],"state":"closed","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":4,"created_at":"2016-07-20T09:34:11Z","updated_at":"2016-07-20T16:33:37Z","closed_at":"2016-07-20T16:33:37Z","body":"I think I have root cause outlined in comments below.  Here is a nice repro case:\r\n\r\nThis code should print entries for both \"potato_id\" and \"created\" keys\r\n\r\n```\r\npackage main\r\n\r\nimport (\r\n        \"fmt\"\r\n        \"github.com/buger/jsonparser\"\r\n)\r\n\r\nfunc main() {\r\n\r\n        json := []byte(`{\"potato_id\": \"6\", \"created\": \"2016-07-19 15:23:00\"}`)\r\n\r\n        paths := [][]string{\r\n                []string{\"potato_id\"},\r\n                []string{\"created\"},\r\n        }\r\n\r\n        jsonparser.EachKey(json, func(pathIdx int, value []byte, dtype jsonparser.ValueType, err error) {\r\n                fmt.Printf(\"found %s -> %s\\n\", paths[pathIdx], string(value))\r\n        }, paths...)\r\n}\r\n```\r\n\r\nBut I only see potato_id:\r\n```\r\nnieksand$ ./bugrepro \r\nfound [potato_id] -> 6\r\n```\r\n\r\nBut if I comment out the \"potato_id\" path, then I suddenly see the \"created\" key.\r\n```\r\n...snip...\r\n        paths := [][]string{\r\n//                []string{\"potato_id\"},\r\n                []string{\"created\"},\r\n        }\r\n...snip...\r\n```\r\n\r\n```\r\nnieksand$ ./bugrepro \r\nfound [created] -> 2016-07-19 15:23:00\r\n```\r\n\r\nUnless I'm misunderstanding the purpose of EachKey, I would expect the original program to print both entries."}}
{"actor":{"display_login":"buger"}}