{"action":"created","issue":{"url":"https://api.github.com/repos/jllodra/ncdump-json/issues/6","labels_url":"https://api.github.com/repos/jllodra/ncdump-json/issues/6/labels{/name}","comments_url":"https://api.github.com/repos/jllodra/ncdump-json/issues/6/comments","events_url":"https://api.github.com/repos/jllodra/ncdump-json/issues/6/events","html_url":"https://github.com/jllodra/ncdump-json/pull/6","id":108602397,"number":6,"title":"Cast all attribute numbers to string","user":{"login":"ocehugo","id":1202691,"avatar_url":"https://avatars.githubusercontent.com/u/1202691?v=3","gravatar_id":"","url":"https://api.github.com/users/ocehugo","html_url":"https://github.com/ocehugo","followers_url":"https://api.github.com/users/ocehugo/followers","following_url":"https://api.github.com/users/ocehugo/following{/other_user}","gists_url":"https://api.github.com/users/ocehugo/gists{/gist_id}","starred_url":"https://api.github.com/users/ocehugo/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/ocehugo/subscriptions","organizations_url":"https://api.github.com/users/ocehugo/orgs","repos_url":"https://api.github.com/users/ocehugo/repos","events_url":"https://api.github.com/users/ocehugo/events{/privacy}","received_events_url":"https://api.github.com/users/ocehugo/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":2,"created_at":"2015-09-28T07:29:53Z","updated_at":"2015-09-29T07:14:26Z","closed_at":null,"pull_request":{"url":"https://api.github.com/repos/jllodra/ncdump-json/pulls/6","html_url":"https://github.com/jllodra/ncdump-json/pull/6","diff_url":"https://github.com/jllodra/ncdump-json/pull/6.diff","patch_url":"https://github.com/jllodra/ncdump-json/pull/6.patch"},"body":"Hi,\r\n\r\nthanks for the software. I was having some problems with Attributes with numbers on:\r\n\r\nnetcdf test {\r\ndimensions:\r\ntime = 1;\r\nvariables:\r\nfloat temperature(time);\r\ntemperature:valid_min = 0s ;\r\ntemperature.valid_max = 0.01f;\r\n\r\n:title = \"\";\r\n}\r\n\r\n\r\nSo I hacked the ncdump source code...Don't know if it will break anything since I can't run the tests scripts (osx here and no json_verify).\r\nJust a quick and dirty fix, but works for me using python json.tool.\r\n\r\nCheers"},"comment":{"url":"https://api.github.com/repos/jllodra/ncdump-json/issues/comments/143969731","html_url":"https://github.com/jllodra/ncdump-json/pull/6#issuecomment-143969731","issue_url":"https://api.github.com/repos/jllodra/ncdump-json/issues/6","id":143969731,"user":{"login":"ocehugo","id":1202691,"avatar_url":"https://avatars.githubusercontent.com/u/1202691?v=3","gravatar_id":"","url":"https://api.github.com/users/ocehugo","html_url":"https://github.com/ocehugo","followers_url":"https://api.github.com/users/ocehugo/followers","following_url":"https://api.github.com/users/ocehugo/following{/other_user}","gists_url":"https://api.github.com/users/ocehugo/gists{/gist_id}","starred_url":"https://api.github.com/users/ocehugo/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/ocehugo/subscriptions","organizations_url":"https://api.github.com/users/ocehugo/orgs","repos_url":"https://api.github.com/users/ocehugo/repos","events_url":"https://api.github.com/users/ocehugo/events{/privacy}","received_events_url":"https://api.github.com/users/ocehugo/received_events","type":"User","site_admin":false},"created_at":"2015-09-29T07:14:26Z","updated_at":"2015-09-29T07:14:26Z","body":"Hi @jlodra,\r\n\r\nMy example was wrong. I corrected the snippet above to make it consistent with the problem of this PR.\r\n\r\n1.The problem can be reproduced in the raw example that I rewrote above. if the attributes of the variables have the following `1000f` or `0d`  (the cdl way to provide the type (float,int,etc)) the result of the json dump is invalid since the value of the attribute is set to a number with a letter at the end. \r\n\r\nHowto reproduce:\r\nGenerate the netcdf of the snipet above and try to import the jsondump. It will fail because the attributes are set as numbers but they arent number for json readers (the \"f\" or \"d\" at the end). So to be readable it should be casted to string (double quotes). To test the json output im using `ncdump-json -h -j file.nc | python -m json.tool` to see if its valid or not.\r\n\r\n\"The supposed way\" that i see for of ncdump-json would be to break out all attributes in new keys:value pairs for the type and value of the attribute. so if the attribute of a variable have a number followed by a letter \"f\",\"s\",etc is should generate 2 new items, type (of att) and value (of att).\r\n\r\n\r\nIn the process i discovery other flaws (see new issues):\r\n\r\n1. ncdump-json doesn't support netcdf4 group cdl (It's include a empty {} on the top of the json file) - My older snippet with groups was not generating valid json dumps\r\n\r\n2. ncdump-json doesn't not generate a valid json dump if there is no global attributes (the program include an extra } at the end of the file)\r\n\r\n\r\n\r\n\r\n"}}