{"action":"created","issue":{"url":"https://api.github.com/repos/sailorproject/sailor/issues/86","repository_url":"https://api.github.com/repos/sailorproject/sailor","labels_url":"https://api.github.com/repos/sailorproject/sailor/issues/86/labels{/name}","comments_url":"https://api.github.com/repos/sailorproject/sailor/issues/86/comments","events_url":"https://api.github.com/repos/sailorproject/sailor/issues/86/events","html_url":"https://github.com/sailorproject/sailor/issues/86","id":134843797,"number":86,"title":"Add a page:json function","user":{"login":"louis77","id":1240462,"avatar_url":"https://avatars.githubusercontent.com/u/1240462?v=3","gravatar_id":"","url":"https://api.github.com/users/louis77","html_url":"https://github.com/louis77","followers_url":"https://api.github.com/users/louis77/followers","following_url":"https://api.github.com/users/louis77/following{/other_user}","gists_url":"https://api.github.com/users/louis77/gists{/gist_id}","starred_url":"https://api.github.com/users/louis77/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/louis77/subscriptions","organizations_url":"https://api.github.com/users/louis77/orgs","repos_url":"https://api.github.com/users/louis77/repos","events_url":"https://api.github.com/users/louis77/events{/privacy}","received_events_url":"https://api.github.com/users/louis77/received_events","type":"User","site_admin":false},"labels":[],"state":"closed","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":6,"created_at":"2016-02-19T11:35:38Z","updated_at":"2016-10-16T12:35:56Z","closed_at":"2016-02-26T10:16:15Z","body":"Since returning JSON content is such a common case now, I propose to add a json function to the page module, where I just pass a variable plus options (which are passed to dkjson), like so:\r\n\r\n```\r\npage:json( data, { indent = true })\r\n```\r\n\r\nThis essentially should do:\r\n\r\n```\r\nlocal json = require \"dkjson\"\r\npage.theme = nil\r\npage.layout = nil\r\npage.r.content_type = 'application/json'\r\npage:write(json.encode(data, {indent=true}))\r\n```\r\n\r\nWhat do you think?"},"comment":{"url":"https://api.github.com/repos/sailorproject/sailor/issues/comments/254044483","html_url":"https://github.com/sailorproject/sailor/issues/86#issuecomment-254044483","issue_url":"https://api.github.com/repos/sailorproject/sailor/issues/86","id":254044483,"user":{"login":"leonardoaraujosantos","id":898383,"avatar_url":"https://avatars.githubusercontent.com/u/898383?v=3","gravatar_id":"","url":"https://api.github.com/users/leonardoaraujosantos","html_url":"https://github.com/leonardoaraujosantos","followers_url":"https://api.github.com/users/leonardoaraujosantos/followers","following_url":"https://api.github.com/users/leonardoaraujosantos/following{/other_user}","gists_url":"https://api.github.com/users/leonardoaraujosantos/gists{/gist_id}","starred_url":"https://api.github.com/users/leonardoaraujosantos/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/leonardoaraujosantos/subscriptions","organizations_url":"https://api.github.com/users/leonardoaraujosantos/orgs","repos_url":"https://api.github.com/users/leonardoaraujosantos/repos","events_url":"https://api.github.com/users/leonardoaraujosantos/events{/privacy}","received_events_url":"https://api.github.com/users/leonardoaraujosantos/received_events","type":"User","site_admin":false},"created_at":"2016-10-16T12:35:56Z","updated_at":"2016-10-16T12:35:56Z","body":"I've also tested the presence of dkjson itself (I'm using through torch)\r\n\r\n```\r\nlaraujo@lindev:~/work/densecap/testWeb/hey_arnold$ th\r\n \r\n  ______             __   |  Torch7 \r\n /_  __/__  ________/ /   |  Scientific computing for Lua. \r\n  / / / _ \\/ __/ __/ _ \\  |  Type ? for help \r\n /_/  \\___/_/  \\__/_//_/  |  https://github.com/torch \r\n                          |  http://torch.ch \r\n\t\r\nth> require \"dkjson\"\r\n{\r\n  addnewline : function: 0x414d6358\r\n  encodeexception : function: 0x40ea83a0\r\n  use_lpeg : function: 0x417fc118\r\n  decode : function: 0x41625f30\r\n  quotestring : function: 0x414ce208\r\n  null : {...}\r\n  encode : function: 0x408b9dc8\r\n  version : \"dkjson 2.5\"\r\n}\r\n\r\n```"}}
{"actor":{"display_login":"leonardoaraujosantos"}}