# How to add a JSON example in a POST Request Body? (without a schema reference)

**URL:** <https://community.smartbear.com/t/how-to-add-a-json-example-in-a-post-request-body-without-a-schema-reference/234>\
**Category:** Swagger OS\
**Tags:** api, migrated, swagger-oss, swagger-editor\
**Created:** [September 1, 2020, 2:55pm UTC](https://community.smartbear.com/t/how-to-add-a-json-example-in-a-post-request-body-without-a-schema-reference/234 "2020-09-01T14:55:05Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![system](https://avatars.discourse-cdn.com/v4/letter/s/bcef8e/32.png) [@system](https://community.smartbear.com/u/system)\
**Post date:** [September 1, 2020, 2:55pm UTC](https://community.smartbear.com/t/how-to-add-a-json-example-in-a-post-request-body-without-a-schema-reference/234/1 "2020-09-01T14:55:05Z")

</div>

> Originally posted by **bdipasca** on September 01, 2020

I came across this [spec example](https://github.com/OAI/OpenAPI-Specification/blob/master/examples/v3.0/api-with-examples.yaml) on the OpenAPI Spec Github where there is a JSON example pasted directly into the GET response:

 ![Screen Shot 2020-09-01 at 10.42.00 AM.png](https://canada1.discourse-cdn.com/flex049/uploads/smartbear_prod/original/1X/aa3dfe8345805c6f95406c93739b5dfa30456d28.png)

Is it possible to do something similar for the POST request body? I have tried replicating this, but receive a render error on the UI:

 ![Screen Shot 2020-09-01 at 10.45.05 AM.png](https://canada1.discourse-cdn.com/flex049/uploads/smartbear_prod/original/1X/860cef500971e9dc100391a7734473c0e247fd34.png)

 ![Screen Shot 2020-09-01 at 10.47.04 AM.png](https://canada1.discourse-cdn.com/flex049/uploads/smartbear_prod/original/1X/e5e2cf4c3feddd5354ff6845c4ddc999e9deff67.png)

I know that I can use a schema reference to define the JSON request, but it would be very nice to be able to directly paste a JSON example into the YAML file. Note sure why this would be possible for a response body but not a request body. Any input would be appreciated!

---

<div class="post-metadata">

**Author:** ![system](https://avatars.discourse-cdn.com/v4/letter/s/bcef8e/32.png) [@system](https://community.smartbear.com/u/system)\
**Post date:** [September 1, 2020, 3:22pm UTC](https://community.smartbear.com/t/how-to-add-a-json-example-in-a-post-request-body-without-a-schema-reference/234/2 "2020-09-01T15:22:52Z")

</div>

> Originally posted by **HKosova** on September 01, 2020

Hi bdipasca,

You can add examples for the request bodies too, but please also add a “schema”:

```auto
      requestBody:
        content:
          application/json:
            schema: # <-------
              type: object
            examples:
              foo:
                value:
                  ...

```

There’s a [known issue](https://github.com/swagger-api/swagger-ui/issues/6268) where examples cannot be rendered if “schema” isn’t provided.

---

<div class="post-metadata">

**Author:** ![system](https://avatars.discourse-cdn.com/v4/letter/s/bcef8e/32.png) [@system](https://community.smartbear.com/u/system)\
**Post date:** [September 1, 2020, 8:52pm UTC](https://community.smartbear.com/t/how-to-add-a-json-example-in-a-post-request-body-without-a-schema-reference/234/3 "2020-09-01T20:52:12Z")

</div>

> Originally posted by **bdipasca** on September 01, 2020

thank you very much HKosova this is what I was looking for!

---

<div class="post-metadata">

**Author:** ![system](https://avatars.discourse-cdn.com/v4/letter/s/bcef8e/32.png) [@system](https://community.smartbear.com/u/system)\
**Post date:** [October 7, 2026, 5:13pm UTC](https://community.smartbear.com/t/how-to-add-a-json-example-in-a-post-request-body-without-a-schema-reference/234/4 "2026-10-07T17:13:45Z")

</div>

Closed on October 7, 2026, 5:13pm UTC

This topic was automatically closed 5 days after the last reply. New replies are no longer allowed.
