{"action":"created","issue":{"url":"https://api.github.com/repos/hjson/hjson-js/issues/40","repository_url":"https://api.github.com/repos/hjson/hjson-js","labels_url":"https://api.github.com/repos/hjson/hjson-js/issues/40/labels{/name}","comments_url":"https://api.github.com/repos/hjson/hjson-js/issues/40/comments","events_url":"https://api.github.com/repos/hjson/hjson-js/issues/40/events","html_url":"https://github.com/hjson/hjson-js/issues/40","id":379988298,"node_id":"MDU6SXNzdWUzNzk5ODgyOTg=","number":40,"title":"hjson-comments.extract/merge doesn't roundtrip array comments correctly.","user":{"login":"ygraber","id":25615308,"node_id":"MDQ6VXNlcjI1NjE1MzA4","avatar_url":"https://avatars1.githubusercontent.com/u/25615308?v=4","gravatar_id":"","url":"https://api.github.com/users/ygraber","html_url":"https://github.com/ygraber","followers_url":"https://api.github.com/users/ygraber/followers","following_url":"https://api.github.com/users/ygraber/following{/other_user}","gists_url":"https://api.github.com/users/ygraber/gists{/gist_id}","starred_url":"https://api.github.com/users/ygraber/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/ygraber/subscriptions","organizations_url":"https://api.github.com/users/ygraber/orgs","repos_url":"https://api.github.com/users/ygraber/repos","events_url":"https://api.github.com/users/ygraber/events{/privacy}","received_events_url":"https://api.github.com/users/ygraber/received_events","type":"User","site_admin":false},"labels":[],"state":"closed","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":1,"created_at":"2018-11-12T23:06:43Z","updated_at":"2018-11-13T15:18:38Z","closed_at":"2018-11-13T15:18:38Z","author_association":"CONTRIBUTOR","body":"When trying to extract comments from the following hjson:\r\n```\r\n{\r\n    a: 1,\r\n    b: 2, # comment\r\n    c: [\r\n        'x',\r\n        'y', #why?\r\n        'z' // zee\r\n    ]\r\n}\r\n```\r\nyou wind up with:\r\n```\r\n{\r\n  a: 1\r\n  b: 2 # comment\r\n  c:\r\n  [\r\n    \"x\" #why?\r\n    \"y\" // zee\r\n    z\r\n  ]\r\n}\r\n```\r\nThat is because extract is putting the comments into a sparse array `a` which only has elements for entries with comments (this will not hold up if the comments are themselves serialized to JSON). When merge is called, it is looping over all array elements and then transferring the comments to the current value.__COMMENTS__, but it is using push and losing all index information."},"comment":{"url":"https://api.github.com/repos/hjson/hjson-js/issues/comments/438303239","html_url":"https://github.com/hjson/hjson-js/issues/40#issuecomment-438303239","issue_url":"https://api.github.com/repos/hjson/hjson-js/issues/40","id":438303239,"node_id":"MDEyOklzc3VlQ29tbWVudDQzODMwMzIzOQ==","user":{"login":"dqsully","id":9079721,"node_id":"MDQ6VXNlcjkwNzk3MjE=","avatar_url":"https://avatars1.githubusercontent.com/u/9079721?v=4","gravatar_id":"","url":"https://api.github.com/users/dqsully","html_url":"https://github.com/dqsully","followers_url":"https://api.github.com/users/dqsully/followers","following_url":"https://api.github.com/users/dqsully/following{/other_user}","gists_url":"https://api.github.com/users/dqsully/gists{/gist_id}","starred_url":"https://api.github.com/users/dqsully/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/dqsully/subscriptions","organizations_url":"https://api.github.com/users/dqsully/orgs","repos_url":"https://api.github.com/users/dqsully/repos","events_url":"https://api.github.com/users/dqsully/events{/privacy}","received_events_url":"https://api.github.com/users/dqsully/received_events","type":"User","site_admin":false},"created_at":"2018-11-13T15:18:38Z","updated_at":"2018-11-13T15:18:38Z","author_association":"MEMBER","body":"Fixed by #41 "}}
{"actor":{"display_login":"dqsully"}}