Hacked in pretty JSON option

Just need to include `?pretty=true` to a request and the JSON returned will be formatted. As I was digging in there I think I may consolidate all of the Display logic into a single class and potentially bring back `.json` and `.xml` extensions to dictate what is returned. Would help a ton in scenarios where I have an endpoint that I want to server up a template on error or return JSON on success.
This commit is contained in:
Josh Sherman 2013-12-24 14:17:03 -05:00
parent cce87a104e
commit ae66815cb9

View file

@ -128,7 +128,7 @@ class Display_PHP extends Display_Common
} }
else else
{ {
echo json_encode($this->module_return); echo json_encode($this->module_return, isset($_GET['pretty']) ? JSON_PRETTY_PRINT : false);
} }
} }
} }