{"action":"created","issue":{"url":"https://api.github.com/repos/elgs/dns-zonefile/issues/15","repository_url":"https://api.github.com/repos/elgs/dns-zonefile","labels_url":"https://api.github.com/repos/elgs/dns-zonefile/issues/15/labels{/name}","comments_url":"https://api.github.com/repos/elgs/dns-zonefile/issues/15/comments","events_url":"https://api.github.com/repos/elgs/dns-zonefile/issues/15/events","html_url":"https://github.com/elgs/dns-zonefile/issues/15","id":141993851,"number":15,"title":"Using JSON.stringify for output of binary program","user":{"login":"h4cc","id":2981491,"avatar_url":"https://avatars.githubusercontent.com/u/2981491?v=3","gravatar_id":"","url":"https://api.github.com/users/h4cc","html_url":"https://github.com/h4cc","followers_url":"https://api.github.com/users/h4cc/followers","following_url":"https://api.github.com/users/h4cc/following{/other_user}","gists_url":"https://api.github.com/users/h4cc/gists{/gist_id}","starred_url":"https://api.github.com/users/h4cc/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/h4cc/subscriptions","organizations_url":"https://api.github.com/users/h4cc/orgs","repos_url":"https://api.github.com/users/h4cc/repos","events_url":"https://api.github.com/users/h4cc/events{/privacy}","received_events_url":"https://api.github.com/users/h4cc/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":5,"created_at":"2016-03-18T22:35:35Z","updated_at":"2016-03-20T08:40:51Z","closed_at":null,"body":"Thanks for this programm.\r\nI had some problems with the output of it, because what i got was something like JSON but not parseable by other languages.\r\n\r\nExample:\r\n\r\n```bash\r\n$ zonefile current.zone \r\n{ '$ttl': '86400',\r\n  soa: \r\n   { name: '@',\r\n     minimum: 86400,\r\n     expire: 604800,\r\n     retry: 1800,\r\n     refresh: 14400,\r\n     serial: 2013103100,\r\n     rname: 'postmaster.robot.first-ns.de.',\r\n     mname: 'ns1.first-ns.de.' },\r\n  ns: \r\n   [ { name: '@', host: 'ns1.first-ns.de.' },\r\n     { name: '@', host: 'robotns2.second-ns.de.' },\r\n     { name: '@', host: 'robotns3.second-ns.com.' } ],\r\n  a: \r\n   [ { name: '@', ip: '1.2.3.4' },\r\n     { name: 'localhost', ip: '127.0.0.1' },\r\n     { name: 'mail', ip: '1.2.3.4' },\r\n     { name: 'www', ip: '1.2.3.4' } ],\r\n  cname: \r\n   [ { name: 'ftp', alias: 'www' },\r\n     { name: 'imap', alias: 'www' },\r\n     { name: 'loopback', alias: 'localhost' },\r\n     { name: 'pop', alias: 'www' },\r\n     { name: 'relay', alias: 'www' },\r\n     { name: 'smtp', alias: 'www' } ],\r\n  mx: [ { name: '@', preference: 10, host: 'mail' } ] }\r\n```\r\n\r\nBut when using `JSON.stringify` before `console.log`, the output because useable JSON:\r\n\r\n```javascript\r\noutput = JSON.stringify(output);\r\nconsole.log(output);\r\n```\r\n\r\nThe unformatted output after that will become:\r\n\r\n```bash\r\n$ zonefile current.zone \r\n{\"$ttl\":\"86400\",\"soa\":{\"name\":\"@\",\"minimum\":86400,\"expire\":604800,\"retry\":1800,\"refresh\":14400,\"serial\":2013103100,\"rname\":\"postmaster.robot.first-ns.de.\",\"mname\":\"ns1.first-ns.de.\"},\"ns\":[{\"name\":\"@\",\"host\":\"ns1.first-ns.de.\"},{\"name\":\"@\",\"host\":\"robotns2.second-ns.de.\"},{\"name\":\"@\",\"host\":\"robotns3.second-ns.com.\"}],\"a\":[{\"name\":\"@\",\"ip\":\"1.2.3.4\"},{\"name\":\"localhost\",\"ip\":\"127.0.0.1\"},{\"name\":\"mail\",\"ip\":\"1.2.3.4\"},{\"name\":\"www\",\"ip\":\"1.2.3.4\"}],\"cname\":[{\"name\":\"ftp\",\"alias\":\"www\"},{\"name\":\"imap\",\"alias\":\"www\"},{\"name\":\"loopback\",\"alias\":\"localhost\"},{\"name\":\"pop\",\"alias\":\"www\"},{\"name\":\"relay\",\"alias\":\"www\"},{\"name\":\"smtp\",\"alias\":\"www\"}],\"mx\":[{\"name\":\"@\",\"preference\":10,\"host\":\"mail\"}]}\r\n```"},"comment":{"url":"https://api.github.com/repos/elgs/dns-zonefile/issues/comments/198872608","html_url":"https://github.com/elgs/dns-zonefile/issues/15#issuecomment-198872608","issue_url":"https://api.github.com/repos/elgs/dns-zonefile/issues/15","id":198872608,"user":{"login":"elgs","id":55955,"avatar_url":"https://avatars.githubusercontent.com/u/55955?v=3","gravatar_id":"","url":"https://api.github.com/users/elgs","html_url":"https://github.com/elgs","followers_url":"https://api.github.com/users/elgs/followers","following_url":"https://api.github.com/users/elgs/following{/other_user}","gists_url":"https://api.github.com/users/elgs/gists{/gist_id}","starred_url":"https://api.github.com/users/elgs/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/elgs/subscriptions","organizations_url":"https://api.github.com/users/elgs/orgs","repos_url":"https://api.github.com/users/elgs/repos","events_url":"https://api.github.com/users/elgs/events{/privacy}","received_events_url":"https://api.github.com/users/elgs/received_events","type":"User","site_admin":false},"created_at":"2016-03-20T08:40:51Z","updated_at":"2016-03-20T08:40:51Z","body":"I have fixed this problem. npm, bower are updated. The `zonefile` command tool outputs JSON in compact mode. If you want pretty output, you may use `jq`, like this:\r\n`zonefile -p my_zonefile.conf | jq .`\r\n\r\nHere is the link to `jq` https://stedolan.github.io/jq/."}}