{"action":"created","issue":{"url":"https://api.github.com/repos/flosch/pongo2/issues/81","labels_url":"https://api.github.com/repos/flosch/pongo2/issues/81/labels{/name}","comments_url":"https://api.github.com/repos/flosch/pongo2/issues/81/comments","events_url":"https://api.github.com/repos/flosch/pongo2/issues/81/events","html_url":"https://github.com/flosch/pongo2/issues/81","id":71113237,"number":81,"title":"request for example of passing JSON into Context without escaping quotes","user":{"login":"tvmaly","id":726081,"avatar_url":"https://avatars.githubusercontent.com/u/726081?v=3","gravatar_id":"","url":"https://api.github.com/users/tvmaly","html_url":"https://github.com/tvmaly","followers_url":"https://api.github.com/users/tvmaly/followers","following_url":"https://api.github.com/users/tvmaly/following{/other_user}","gists_url":"https://api.github.com/users/tvmaly/gists{/gist_id}","starred_url":"https://api.github.com/users/tvmaly/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/tvmaly/subscriptions","organizations_url":"https://api.github.com/users/tvmaly/orgs","repos_url":"https://api.github.com/users/tvmaly/repos","events_url":"https://api.github.com/users/tvmaly/events{/privacy}","received_events_url":"https://api.github.com/users/tvmaly/received_events","type":"User","site_admin":false},"labels":[],"state":"closed","locked":false,"assignee":null,"milestone":null,"comments":1,"created_at":"2015-04-26T20:04:28Z","updated_at":"2015-04-26T20:09:39Z","closed_at":"2015-04-26T20:09:39Z","body":"When I have something like \r\n\r\n\tctx := pongo2.Context{\r\n\t\t\t\"title\":      \"Hello World\",\r\n\t\t\t\"id\":         id,\r\n\t\t\t\"json\": jsonString,\r\n\t}\r\n\r\nInside the template, all the quotes in the jsonString appear as HTML escaped entities.   I am not exactly sure what I need to do to prevent the json from being escaped into HTML entities.  Could you provide an example?\r\n\r\n<bountysource-plugin>\r\n---\r\nWant to back this issue? **[Post a bounty on it!](https://www.bountysource.com/issues/12192991-request-for-example-of-passing-json-into-context-without-escaping-quotes?utm_campaign=plugin&utm_content=tracker%2F3654947&utm_medium=issues&utm_source=github)** We accept bounties via [Bountysource](https://www.bountysource.com/?utm_campaign=plugin&utm_content=tracker%2F3654947&utm_medium=issues&utm_source=github).\r\n</bountysource-plugin>"},"comment":{"url":"https://api.github.com/repos/flosch/pongo2/issues/comments/96429550","html_url":"https://github.com/flosch/pongo2/issues/81#issuecomment-96429550","issue_url":"https://api.github.com/repos/flosch/pongo2/issues/81","id":96429550,"user":{"login":"flosch","id":19232,"avatar_url":"https://avatars.githubusercontent.com/u/19232?v=3","gravatar_id":"","url":"https://api.github.com/users/flosch","html_url":"https://github.com/flosch","followers_url":"https://api.github.com/users/flosch/followers","following_url":"https://api.github.com/users/flosch/following{/other_user}","gists_url":"https://api.github.com/users/flosch/gists{/gist_id}","starred_url":"https://api.github.com/users/flosch/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/flosch/subscriptions","organizations_url":"https://api.github.com/users/flosch/orgs","repos_url":"https://api.github.com/users/flosch/repos","events_url":"https://api.github.com/users/flosch/events{/privacy}","received_events_url":"https://api.github.com/users/flosch/received_events","type":"User","site_admin":false},"created_at":"2015-04-26T20:09:39Z","updated_at":"2015-04-26T20:09:39Z","body":"pongo2 doesn't parse any JSON, you have to parse your JSON string on your own and pass the parsed JSON to the pongo2 context. For example:\r\n\r\n```\r\nimport \"encoding/json\"\r\n\r\ntype Person struct {\r\n    Name string\r\n    Age int\r\n}\r\n\r\nfunc main() {\r\n    jsonStr := `{\"name\": \"jessy\", \"age\": 29}`\r\n    var p Person\r\n    err := json.Unmarshal([]byte(jsonStr), &p)\r\n    if err != nil {\r\n        log.Fatal(err)\r\n    }\r\n    ctx := pongo2.Context{\r\n        \"person\": p,\r\n    }\r\n}\r\n```\r\n\r\nYou can access the fields in a pongo2 template like this: ```Hello {{ person.Name }}```\r\n\r\nDoes this answer your question?"}}