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:
parent
cce87a104e
commit
ae66815cb9
1 changed files with 1 additions and 1 deletions
|
@ -128,7 +128,7 @@ class Display_PHP extends Display_Common
|
|||
}
|
||||
else
|
||||
{
|
||||
echo json_encode($this->module_return);
|
||||
echo json_encode($this->module_return, isset($_GET['pretty']) ? JSON_PRETTY_PRINT : false);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue