# GraphQL Request - pm.response.json is not a function

**URL:** <https://community.postman.com/t/graphql-request-pm-response-json-is-not-a-function/65183>\
**Category:** Help Hub\
**Tags:** tests, json, graphql\
**Created:** [August 6, 2024, 7:59am UTC](https://community.postman.com/t/graphql-request-pm-response-json-is-not-a-function/65183 "2024-08-06T07:59:34Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![jiapei666](https://avatars.discourse-cdn.com/v4/letter/j/9de0a6/32.png) [@jiapei666](https://community.postman.com/u/jiapei666)\
**Post date:** [August 6, 2024, 7:59am UTC](https://community.postman.com/t/graphql-request-pm-response-json-is-not-a-function/65183/1 "2024-08-06T07:59:34Z")

</div>

Hello, guys, I am now testing GraphQL API, and the same as restful API, I want to save the token and set it to variable.

But when I use the “let response = pm.response.json();”, an error occurs,

> “pm.response.json is not a function”.

This happens only when I use the GraphQL basics template to send the request. If I use the regular way : new collection→Add a request… this error will not occur. I do not know where is wrong.

Anybody met this error before? Thx~

---

<div class="post-metadata">

**Author:** ![danny-dainton](https://sea2.discourse-cdn.com/getpostman/user_avatar/community.postman.com/danny-dainton/32/29401_2.png) [@danny-dainton](https://community.postman.com/u/danny-dainton)\
**Post date:** [August 6, 2024, 1:16pm UTC](https://community.postman.com/t/graphql-request-pm-response-json-is-not-a-function/65183/2 "2024-08-06T13:16:06Z")

</div>

Hey @jiapei666 👋

Welcome to the Postman Community! :postman:

When using the GraphQL request, the sandbox syntax is slightly different:

You can use `pm.response.data` to get the response body data:

```auto
let response = pm.response.data

```

We’re working on updating the learning center to reflect this for GraphQL but this would be similar if you were making gRPC requests too:

> **[Write gRPC scripts and tests in Postman using the pm object | Postman...](https://learning.postman.com/docs/sending-requests/grpc/postman-sandbox-api/)**
>
> Postman is a collaboration platform for API development. Postman's features simplify each step of building an API and streamline collaboration so you can create better APIs—faster.

---

<div class="post-metadata">

**Author:** ![jiapei666](https://avatars.discourse-cdn.com/v4/letter/j/9de0a6/32.png) [@jiapei666](https://community.postman.com/u/jiapei666)\
**Post date:** [August 8, 2024, 8:50am UTC](https://community.postman.com/t/graphql-request-pm-response-json-is-not-a-function/65183/3 "2024-08-08T08:50:53Z")

</div>

Thank u for your quick reply~ @danny-dainton

---

<div class="post-metadata">

**Author:** ![system](https://sea2.discourse-cdn.com/getpostman/user_avatar/community.postman.com/system/32/29796_2.png) [@system](https://community.postman.com/u/system)\
**Post date:** [September 7, 2024, 8:51am UTC](https://community.postman.com/t/graphql-request-pm-response-json-is-not-a-function/65183/4 "2024-09-07T08:51:04Z")

</div>

Closed on September 7, 2024, 8:51am UTC

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