{"action":"created","issue":{"url":"https://api.github.com/repos/nodeca/js-yaml/issues/169","labels_url":"https://api.github.com/repos/nodeca/js-yaml/issues/169/labels{/name}","comments_url":"https://api.github.com/repos/nodeca/js-yaml/issues/169/comments","events_url":"https://api.github.com/repos/nodeca/js-yaml/issues/169/events","html_url":"https://github.com/nodeca/js-yaml/issues/169","id":58729406,"number":169,"title":"Trying to use an object as a key results in the string '[object Object]' as a key","user":{"login":"ExplodingCabbage","id":2358339,"avatar_url":"https://avatars.githubusercontent.com/u/2358339?v=3","gravatar_id":"","url":"https://api.github.com/users/ExplodingCabbage","html_url":"https://github.com/ExplodingCabbage","followers_url":"https://api.github.com/users/ExplodingCabbage/followers","following_url":"https://api.github.com/users/ExplodingCabbage/following{/other_user}","gists_url":"https://api.github.com/users/ExplodingCabbage/gists{/gist_id}","starred_url":"https://api.github.com/users/ExplodingCabbage/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/ExplodingCabbage/subscriptions","organizations_url":"https://api.github.com/users/ExplodingCabbage/orgs","repos_url":"https://api.github.com/users/ExplodingCabbage/repos","events_url":"https://api.github.com/users/ExplodingCabbage/events{/privacy}","received_events_url":"https://api.github.com/users/ExplodingCabbage/received_events","type":"User","site_admin":false},"labels":[],"state":"closed","locked":false,"assignee":null,"milestone":null,"comments":4,"created_at":"2015-02-24T12:06:03Z","updated_at":"2015-02-24T20:08:06Z","closed_at":"2015-02-24T19:58:29Z","body":"If I throw the following markup (which I believe is not valid YAML, though I'm not even remotely an expert) into the online YAML parser at http://yaml-online-parser.appspot.com/ ...\r\n\r\n```yaml\r\n{{\"foo\": \"bar\"}: {\"qux\": \"baz\"}}\r\n```\r\n\r\n... then I get:\r\n\r\n> ERROR:\r\n\r\n> while constructing a mapping\r\n  in \"<unicode string>\", line 1, column 1:\r\n    {{\"foo\": \"bar\"}: {\"bla\": \"bla\"}}\r\n    ^\r\n> found unacceptable key (dict objects are unhashable)\r\n  in \"<unicode string>\", line 1, column 2:\r\n    {{\"foo\": \"bar\"}: {\"bla\": \"bla\"}}\r\n\r\nIf I throw it into `yaml.safeLoad`, on the other hand, I don't get an error. Instead I get this:\r\n\r\n<blockquote><code><pre><b>> yaml.safeLoad('{{\"foo\": \"bar\"}: {\"bla\": \"bla\"}}')</b>\r\n{ '[object Object]': { bla: 'bla' } }</pre></code></blockquote>\r\n\r\nWhatever the correct behaviour here is (and I defer that question to those more knowledgable than me), this is plainly not it."},"comment":{"url":"https://api.github.com/repos/nodeca/js-yaml/issues/comments/75835131","html_url":"https://github.com/nodeca/js-yaml/issues/169#issuecomment-75835131","issue_url":"https://api.github.com/repos/nodeca/js-yaml/issues/169","id":75835131,"user":{"login":"ExplodingCabbage","id":2358339,"avatar_url":"https://avatars.githubusercontent.com/u/2358339?v=3","gravatar_id":"","url":"https://api.github.com/users/ExplodingCabbage","html_url":"https://github.com/ExplodingCabbage","followers_url":"https://api.github.com/users/ExplodingCabbage/followers","following_url":"https://api.github.com/users/ExplodingCabbage/following{/other_user}","gists_url":"https://api.github.com/users/ExplodingCabbage/gists{/gist_id}","starred_url":"https://api.github.com/users/ExplodingCabbage/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/ExplodingCabbage/subscriptions","organizations_url":"https://api.github.com/users/ExplodingCabbage/orgs","repos_url":"https://api.github.com/users/ExplodingCabbage/repos","events_url":"https://api.github.com/users/ExplodingCabbage/events{/privacy}","received_events_url":"https://api.github.com/users/ExplodingCabbage/received_events","type":"User","site_admin":false},"created_at":"2015-02-24T20:08:06Z","updated_at":"2015-02-24T20:08:06Z","body":"There are other options too, like parsing it into some structure other than an Object or taking an argument that indicates whether to throw on object keys or not. But silently turning object keys into `\"[object Object]\"` by default seems like it's going to be the wrong thing for the majority of users."}}