# Adding JSON response to First Application Tutorial

**URL:** <https://discourse.slimframework.com/t/adding-json-response-to-first-application-tutorial/2076>\
**Category:** Questions\
**Created:** [December 6, 2017, 12:35am UTC](https://discourse.slimframework.com/t/adding-json-response-to-first-application-tutorial/2076 "2017-12-06T00:35:38Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![troutoil](https://avatars.discourse-cdn.com/v4/letter/t/a183cd/32.png) [@troutoil](https://discourse.slimframework.com/u/troutoil)\
**Post date:** [December 6, 2017, 12:35am UTC](https://discourse.slimframework.com/t/adding-json-response-to-first-application-tutorial/2076/1 "2017-12-06T00:35:38Z")

</div>

Hey there, here’s a full on newb question. I’ve worked through the First Application Tutorial successfully, then used what I learned to essentially rebuild it to fit my needs. I’ve really enjoyed how quickly I was able to pull together a simple API. However, for the life of me I can’t figure out how to return a JSON object instead of the standard response object.

I’ve put in some time searching and haven’t been able to figure anything out.

If I wanted to continue the tutorial, but have /tickets respond with a JSON object, what would be the most Slim-like way for me to accomplish that?

---

<div class="post-metadata">

**Author:** ![tflight](https://yyz2.discourse-cdn.com/flex030/user_avatar/discourse.slimframework.com/tflight/32/1205_2.png) [@tflight](https://discourse.slimframework.com/u/tflight)\
**Post date:** [December 6, 2017, 12:47am UTC](https://discourse.slimframework.com/t/adding-json-response-to-first-application-tutorial/2076/2 "2017-12-06T00:47:46Z")

</div>

Have a look at [Returning JSON](https://www.slimframework.com/docs/objects/response.html#returning-json) and see if that helps a bit. You will return the same response object, but Slim offers a `withJson` helper method.

Also see [the source](https://github.com/slimphp/Slim/blob/c9a768c5a062c5f1aaa0a588d7bb90e8ce18bfd6/Slim/Http/Response.php#L332).

```php
$data = [];
return $response->withJson($data);

```
