{"action":"created","issue":{"url":"https://api.github.com/repos/lodash/lodash/issues/1616","labels_url":"https://api.github.com/repos/lodash/lodash/issues/1616/labels{/name}","comments_url":"https://api.github.com/repos/lodash/lodash/issues/1616/comments","events_url":"https://api.github.com/repos/lodash/lodash/issues/1616/events","html_url":"https://github.com/lodash/lodash/issues/1616","id":114999306,"number":1616,"title":"_.set does not work correctly when a path component is a number","user":{"login":"CensoredUser","id":8042228,"avatar_url":"https://avatars.githubusercontent.com/u/8042228?v=3","gravatar_id":"","url":"https://api.github.com/users/CensoredUser","html_url":"https://github.com/CensoredUser","followers_url":"https://api.github.com/users/CensoredUser/followers","following_url":"https://api.github.com/users/CensoredUser/following{/other_user}","gists_url":"https://api.github.com/users/CensoredUser/gists{/gist_id}","starred_url":"https://api.github.com/users/CensoredUser/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/CensoredUser/subscriptions","organizations_url":"https://api.github.com/users/CensoredUser/orgs","repos_url":"https://api.github.com/users/CensoredUser/repos","events_url":"https://api.github.com/users/CensoredUser/events{/privacy}","received_events_url":"https://api.github.com/users/CensoredUser/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":5,"created_at":"2015-11-04T08:30:40Z","updated_at":"2015-11-04T22:17:29Z","closed_at":null,"body":"**Problem**\r\nWhen a path component used in the `_.set` method contains a number, lodash will incorrectly create an array of that size. \r\n\r\n**Steps to reproduce**\r\n\r\n```javascript\r\nvar bla = {\r\n  test: \"ok\",\r\n  200: \"ok\"\r\n};\r\n\r\nconsole.log(_.get(bla, '200', 'fail'));\r\nconsole.log(_.get(bla, 'test', 'fail'));\r\n\r\n_.set(bla, 'bla.200.bla', 'wow');\r\n\r\nconsole.log(_.get(bla, 'test.200', 'fail'));\r\nconsole.log(bla);\r\n```\r\n\r\n**Expected result**\r\n\r\n```json\r\n{\r\n  \"test\": \"ok\",\r\n  \"200\": \"ok\",\r\n  \"bla\": {\r\n    \"200\": {\r\n      \"bla\": \"wow\"\r\n    }  \r\n  }\r\n};\r\n```\r\n\r\n**Actual result**\r\n\r\n```json\r\n{\r\n   \"200\":\"ok\",\r\n   \"test\":\"ok\",\r\n   \"bla\":[\r\n      null,\r\n      null,\r\n      ... [198 more nulls]\r\n      {\r\n         \"bla\":\"wow\"\r\n      }\r\n   ]\r\n}\r\n```"},"comment":{"url":"https://api.github.com/repos/lodash/lodash/issues/comments/153886863","html_url":"https://github.com/lodash/lodash/issues/1616#issuecomment-153886863","issue_url":"https://api.github.com/repos/lodash/lodash/issues/1616","id":153886863,"user":{"login":"CensoredUser","id":8042228,"avatar_url":"https://avatars.githubusercontent.com/u/8042228?v=3","gravatar_id":"","url":"https://api.github.com/users/CensoredUser","html_url":"https://github.com/CensoredUser","followers_url":"https://api.github.com/users/CensoredUser/followers","following_url":"https://api.github.com/users/CensoredUser/following{/other_user}","gists_url":"https://api.github.com/users/CensoredUser/gists{/gist_id}","starred_url":"https://api.github.com/users/CensoredUser/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/CensoredUser/subscriptions","organizations_url":"https://api.github.com/users/CensoredUser/orgs","repos_url":"https://api.github.com/users/CensoredUser/repos","events_url":"https://api.github.com/users/CensoredUser/events{/privacy}","received_events_url":"https://api.github.com/users/CensoredUser/received_events","type":"User","site_admin":false},"created_at":"2015-11-04T22:17:29Z","updated_at":"2015-11-04T22:17:29Z","body":"Actually, the problem was _not_ `JSON.stringify`. The issue was that the 'object' that was to be the parent node of the object with a numerical key did not exist yet. \r\n\r\nFor example the following will work just fine: \r\n\r\n```javascript\r\nvar bla = { 'test': {} };\r\n_.set(bla, 'test.200.bla', {}); // Will produce { 'test': { '200': { 'bla': {}}}}\r\n```\r\n\r\nHowever this won't:\r\n\r\n```javascript\r\nvar bla = {};\r\n_.set(bla, 'test.200.bla', {}); // Will produce { 'test': [ 200: { 'bla': {}}]} , where 200 is an index\r\n```\r\n\r\nSo it _does_ seem like a bug in lodash."}}