> For the complete documentation index, see [llms.txt](https://cathy-thy.gitbook.io/drupal-9/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://cathy-thy.gitbook.io/drupal-9/modules/paragraphs/views-and-paragraphs.md). Agents can also search and read this documentation through its [MCP server](https://cathy-thy.gitbook.io/drupal-9/~gitbook/mcp).

# Views and Paragraphs

It's simple to use views with normal fields; however, story may get complicated when you have paragraph field in your content type. In this case, with the help of REST Views <https://www.drupal.org/project/rest_views>, we are able to serialize the paragraph field.

But if you are not happy with the format generated by the views or you want more control on the format, you may try [Custom Restful API](https://cathy-thy.gitbook.io/drupal-9/custom-modules/custom-restful-api.md).

#### 1. Download and enable module

![](https://3571417386-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F2c2poVQgh9M8bTCLRSBz%2Fuploads%2Fgit-blob-b95127ad18c3eac627fadffb0d7f34a71883de0b%2Fimage%20\(1\).png?alt=media)

#### 2. Create Views

![](https://3571417386-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F2c2poVQgh9M8bTCLRSBz%2Fuploads%2Fgit-blob-d80ad45be99d9c413972133d416a4f5988ed07de%2Fimage%20\(3\).png?alt=media)

![](https://3571417386-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F2c2poVQgh9M8bTCLRSBz%2Fuploads%2Fgit-blob-2fce1c83a2c035c5f655b72e2f07cb97c174a879%2Fparaview1.png?alt=media)

![](https://3571417386-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F2c2poVQgh9M8bTCLRSBz%2Fuploads%2Fgit-blob-c078689954a386a7180f92683016f201e19e0088%2Fparaview2.png?alt=media)

{% hint style="success" %}
Result:
{% endhint %}

You are able to get all details within the paragraph field. Key name "field\_*card*\_para\_ref\_export".

<details>

<summary>Sample Result</summary>

```
[
  {
    "title": "Male Profile",
    "field_profile_card_para_ref_export": [
      {
        "type": "paragraph",
        "age": "20",
        "name": "Peter",
        "personal_introduction": "<p><strong>Lorem Ipsum</strong> is simply dummy text of the printing and typesetting industry. Lorem Ipsum has been the industry's standard dummy text ever since the 1500s, when an unknown printer took a galley of type and scrambled it to make a type specimen book. It has survived not only five centuries, but also the leap into electronic typesetting, remaining essentially unchanged. It was popularised in the 1960s with the release of Letraset sheets containing Lorem Ipsum passages, and more recently with desktop publishing software like Aldus PageMaker including versions of Lorem Ipsum.</p>",
        "profile_picture": "<article data-quickedit-entity-id=\"media/1\" class=\"contextual-region media media--type-image media--view-mode-default\">\n  <div data-contextual-id=\"media:media=1:changed=1643343154&amp;langcode=en\" data-contextual-token=\"-2y46dUXUUQszaPSHr0kf-ax8abVf6CtmDTG5Qq-5pc\"></div>\n      \n  <div data-quickedit-field-id=\"media/1/field_media_image/en/default\" class=\"field field--name-field-media-image field--type-image field--label-visually_hidden\">\n    <div class=\"field__label visually-hidden\">Image</div>\n              <div class=\"field__item\">  <img src=\"/d9-demo/web/sites/default/files/styles/large/public/2022-01/ben-parker-OhKElOkQ3RE-unsplash.jpg?itok=rSNXRGD9\" width=\"320\" height=\"480\" alt=\"Peter\" loading=\"lazy\" typeof=\"foaf:Image\" class=\"image-style-large\" />\n\n\n</div>\n          </div>\n\n  </article>\n"
      }
    ]
  }
]
```

</details>

![](https://3571417386-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F2c2poVQgh9M8bTCLRSBz%2Fuploads%2Fgit-blob-dede3c732b4e65d5d3f4a2ab3fddf6dbf9920c7b%2Fimage%20\(4\).png?alt=media)

### Media Image

From the above response, you can see that the media image is giving out details which we may not interested in. Most often, we want to get the image url only.

#### Get media image url for media field in paragraph
