# Missing JSON Content-Type header for routed JSON representation

**URL:** <https://forum.getkirby.com/t/missing-json-content-type-header-for-routed-json-representation/19136>\
**Category:** Questions\
**Tags:** v3\
**Created:** [August 21, 2020, 11:18am UTC](https://forum.getkirby.com/t/missing-json-content-type-header-for-routed-json-representation/19136 "2020-08-21T11:18:31Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![Stefan741](https://avatars.discourse-cdn.com/v4/letter/s/71e660/32.png) [@Stefan741](https://forum.getkirby.com/u/Stefan741)\
**Post date:** [August 21, 2020, 11:18am UTC](https://forum.getkirby.com/t/missing-json-content-type-header-for-routed-json-representation/19136/1 "2020-08-21T11:18:31Z")

</div>

Hi folks

Thanks to @texnixe I was able to route the pattern `apitest` to `/home.json`, which is a simple JSON representation of my home site. The routing is as follows:

```
[
    'pattern' => 'apitest',
    'action' => function () {
        return page('home')->render([], 'json');
    }
],

```

The routing itself work, but the HTTP Content-Type of the response is set to `text/html` instead of `application/json`. I also tried to manually add the header with `Header::contentType('application/json', 'UTF-8', true);` and `header('Content-type: application/json');` but with no luck.

If I access the JSON representation without route at `/home.json`, the Content-Type of the response is correctly set to `application/json`.

Any ideas? Or maybe a bug?

Best,

Stefan

---

<div class="post-metadata">

**Author:** ![texnixe](https://dub1.discourse-cdn.com/flex017/user_avatar/forum.getkirby.com/texnixe/32/5754_2.png) [@texnixe](https://forum.getkirby.com/u/texnixe)\
**Post date:** [August 21, 2020, 6:37pm UTC](https://forum.getkirby.com/t/missing-json-content-type-header-for-routed-json-representation/19136/2 "2020-08-21T18:37:55Z")

</div>

You can send a response like this with type and header (not quite sure how to use this in conjunction with the `$page->render()` function):

```auto
$kirby
    ->response()
    ->code(202)
    ->type('rss')
    ->header('x-foo', 'bar');

```
