KnowledgeHub
Questions
Tags
Users
Search
Alex Rivera
|
Logout
Edit Question
Title
Body
Whenever I try to print out json from python, it ignores line breaks and prints the literal string "\n" instead of new line characters. I'm generating json using jinja2. Here's my code: print json.dumps(template.render(**self.config['templates'][name])) It prints out everything in the block below (literally - even the quotes and "\n" strings): "{\n \"AWSTemplateFormatVersion\" : \"2010-09-09\",\n \"Description\" : ... (truncated) I get something like this whenever I try to dump anything but a dict. Even if I try json.loads() then dump it again I get garbage. It just strips out all line breaks. What's going wrong?
Tags (comma-separated)
Save Edits
Cancel