Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

JSON pretty print #388

Open
damianobarbati opened this issue Apr 17, 2018 · 1 comment
Open

JSON pretty print #388

damianobarbati opened this issue Apr 17, 2018 · 1 comment

Comments

@damianobarbati
Copy link

Is it possible to send pretty-printed json in response?

$klein->respond('/hello-world', function ($request, $response) {
    $result = $request->params();
    return $response->jsonPretty($result);
});
@somethingweird
Copy link

You could copy json method in Klein/Response.php and call it jsonPretty and instead of $json = json_encode($object) you could use $json = json_encode($object, JSON_PRETTY_PRINT);

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants