# How to output post as JSON for api?

**URL:** <https://discourse.gohugo.io/t/how-to-output-post-as-json-for-api/23932>\
**Category:** support\
**Created:** [March 11, 2020, 12:25pm UTC](https://discourse.gohugo.io/t/how-to-output-post-as-json-for-api/23932 "2020-03-11T12:25:22Z")\
**Posts on this page:** 8\
**Page:** 1

<div class="post-metadata">

**Author:** ![Prashant\_Verma](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.gohugo.io/prashant_verma/32/10749_2.png) [@Prashant\_Verma](https://discourse.gohugo.io/u/Prashant_Verma)\
**Post date:** [March 11, 2020, 12:25pm UTC](https://discourse.gohugo.io/t/how-to-output-post-as-json-for-api/23932/1 "2020-03-11T12:25:23Z")

</div>

I want to display the content on mobile app. But for that I need rest api for that. Is it possible to display post as restapi?

---

<div class="post-metadata">

**Author:** ![maiki](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.gohugo.io/maiki/32/16384_2.png) [@maiki](https://discourse.gohugo.io/u/maiki)\
**Post date:** [March 11, 2020, 6:36pm UTC](https://discourse.gohugo.io/t/how-to-output-post-as-json-for-api/23932/2 "2020-03-11T18:36:32Z")

</div>

> [@Prashant\_Verma](#):
>
> Is it possible to display post as restapi?

Not with Hugo.

---

<div class="post-metadata">

**Author:** ![maiki](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.gohugo.io/maiki/32/16384_2.png) [@maiki](https://discourse.gohugo.io/u/maiki)\
**Post date:** [March 11, 2020, 6:36pm UTC](https://discourse.gohugo.io/t/how-to-output-post-as-json-for-api/23932/3 "2020-03-11T18:36:45Z")

</div>



---

<div class="post-metadata">

**Author:** ![olafghanizadeh](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.gohugo.io/olafghanizadeh/32/4494_2.png) [@olafghanizadeh](https://discourse.gohugo.io/u/olafghanizadeh)\
**Post date:** [March 16, 2020, 11:09am UTC](https://discourse.gohugo.io/t/how-to-output-post-as-json-for-api/23932/4 "2020-03-16T11:09:37Z")

</div>

> [@How to output post as JSON for api?](https://discourse.gohugo.io/t/how-to-output-post-as-json-for-api/23932/2):
>
> Not with Hugo.

I think this answer could be more helpful. You can quite easily create an API with the use of custom output formats as described in:

> **[Forestry.io CMS](https://tina.io/forestry/)**
>
> The Forestry.io team is now focused on building TinaCMS. If you wish to migrate your Forestry site to Tina, follow the guide below.

---

<div class="post-metadata">

**Author:** ![alexandros](https://avatars.discourse-cdn.com/v4/letter/a/ecc23a/32.png) [@alexandros](https://discourse.gohugo.io/u/alexandros)\
**Post date:** [March 16, 2020, 12:38pm UTC](https://discourse.gohugo.io/t/how-to-output-post-as-json-for-api/23932/5 "2020-03-16T12:38:34Z")

</div>

@olafghanizadeh

I moved your reply here for posterity.

This topic is archived. If anyone needs something else about Hugo’s Custom Output Formats they can open a new topic.

---

<div class="post-metadata">

**Author:** ![alexandros](https://avatars.discourse-cdn.com/v4/letter/a/ecc23a/32.png) [@alexandros](https://discourse.gohugo.io/u/alexandros)\
**Post date:** [March 16, 2020, 12:39pm UTC](https://discourse.gohugo.io/t/how-to-output-post-as-json-for-api/23932/6 "2020-03-16T12:39:27Z")

</div>



---

<div class="post-metadata">

**Author:** ![maiki](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.gohugo.io/maiki/32/16384_2.png) [@maiki](https://discourse.gohugo.io/u/maiki)\
**Post date:** [March 16, 2020, 7:16pm UTC](https://discourse.gohugo.io/t/how-to-output-post-as-json-for-api/23932/7 "2020-03-16T19:16:14Z")

</div>

> [@olafghanizadeh](#):
>
> I think this answer could be more helpful.

Fine: you can not create a RESTful API with Hugo; Hugo is a static site generator, and while that means it can be used in a complicated workflow, one should not rely on it for tasks it is clearly not designed.

Sorry @alexandros, I wanted to make it a full answer for posterity. ^\_~

---

<div class="post-metadata">

**Author:** ![alexandros](https://avatars.discourse-cdn.com/v4/letter/a/ecc23a/32.png) [@alexandros](https://discourse.gohugo.io/u/alexandros)\
**Post date:** [March 16, 2020, 7:17pm UTC](https://discourse.gohugo.io/t/how-to-output-post-as-json-for-api/23932/8 "2020-03-16T19:17:20Z")

</div>

No problem.
