{"action":"created","issue":{"url":"https://api.github.com/repos/Araq/Nim/issues/1869","labels_url":"https://api.github.com/repos/Araq/Nim/issues/1869/labels{/name}","comments_url":"https://api.github.com/repos/Araq/Nim/issues/1869/comments","events_url":"https://api.github.com/repos/Araq/Nim/issues/1869/events","html_url":"https://github.com/Araq/Nim/pull/1869","id":53354680,"number":1869,"title":"Json stuff","user":{"login":"def-","id":2335377,"avatar_url":"https://avatars.githubusercontent.com/u/2335377?v=3","gravatar_id":"","url":"https://api.github.com/users/def-","html_url":"https://github.com/def-","followers_url":"https://api.github.com/users/def-/followers","following_url":"https://api.github.com/users/def-/following{/other_user}","gists_url":"https://api.github.com/users/def-/gists{/gist_id}","starred_url":"https://api.github.com/users/def-/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/def-/subscriptions","organizations_url":"https://api.github.com/users/def-/orgs","repos_url":"https://api.github.com/users/def-/repos","events_url":"https://api.github.com/users/def-/events{/privacy}","received_events_url":"https://api.github.com/users/def-/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":10,"created_at":"2015-01-05T00:34:18Z","updated_at":"2015-01-12T00:50:58Z","closed_at":null,"pull_request":{"url":"https://api.github.com/repos/Araq/Nim/pulls/1869","html_url":"https://github.com/Araq/Nim/pull/1869","diff_url":"https://github.com/Araq/Nim/pull/1869.diff","patch_url":"https://github.com/Araq/Nim/pull/1869.patch"},"body":"Some people said it's a pain to generate JSON in Nim. Since Nim is statically typed you can't just write\r\n```nim\r\nvar j = [{\"name\": \"John\", \"age\": 30}, {\"name\": \"Susan\", \"age\": 31}]\r\n```\r\nInstead you have to add a `%` everywhere to convert to JSON:\r\n```nim\r\nvar j = %[%{\"name\": %\"John\", \"age\": %30}, %{\"name\": %\"Susan\", \"age\": %31}]\r\n```\r\nThat's annoying if you just want to paste some actual JSON into your source and set a few variables. The new `%*` macro automatically adds `%` where necessary. So you can write now:\r\n```nim\r\nvar j = %*[{\"name\": \"John\", \"age\": 30}, {\"name\": \"Susan\", \"age\": 31}]\r\n```\r\nOr even with pretty indentation of your choice:\r\n```nim\r\nvar j2 = %*\r\n  [\r\n    {\r\n      \"name\": \"John\",\r\n      \"age\": 30\r\n    },\r\n    {\r\n      \"name\": \"Susan\",\r\n      \"age\": 31\r\n    }\r\n  ]\r\necho j2\r\n\r\nvar name = \"John\"\r\nlet herAge = 30\r\nconst hisAge = 31\r\n\r\nvar j3 = %*\r\n  [ { \"name\": name\r\n    , \"age\": herAge\r\n    }\r\n  , { \"name\": \"Susan\"\r\n    , \"age\": hisAge\r\n    }\r\n  ]\r\necho j3\r\n```"},"comment":{"url":"https://api.github.com/repos/Araq/Nim/issues/comments/69520539","html_url":"https://github.com/Araq/Nim/pull/1869#issuecomment-69520539","issue_url":"https://api.github.com/repos/Araq/Nim/issues/1869","id":69520539,"user":{"login":"Araq","id":287816,"avatar_url":"https://avatars.githubusercontent.com/u/287816?v=3","gravatar_id":"","url":"https://api.github.com/users/Araq","html_url":"https://github.com/Araq","followers_url":"https://api.github.com/users/Araq/followers","following_url":"https://api.github.com/users/Araq/following{/other_user}","gists_url":"https://api.github.com/users/Araq/gists{/gist_id}","starred_url":"https://api.github.com/users/Araq/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Araq/subscriptions","organizations_url":"https://api.github.com/users/Araq/orgs","repos_url":"https://api.github.com/users/Araq/repos","events_url":"https://api.github.com/users/Araq/events{/privacy}","received_events_url":"https://api.github.com/users/Araq/received_events","type":"User","site_admin":false},"created_at":"2015-01-12T00:50:58Z","updated_at":"2015-01-12T00:50:58Z","body":"I like %* better than jsonify."}}