# Node.js SDK response.body vs response.result

**URL:** <https://developer.squareup.com/forums/t/node-js-sdk-response-body-vs-response-result/10400>\
**Category:** Questions\
**Tags:** customers-api, sdk, node-js\
**Created:** [August 21, 2023, 10:10pm UTC](https://developer.squareup.com/forums/t/node-js-sdk-response-body-vs-response-result/10400 "2023-08-21T22:10:26Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![goodjuju](https://avatars.discourse-cdn.com/v4/letter/g/dfb087/32.png) [@goodjuju](https://developer.squareup.com/forums/u/goodjuju)\
**Post date:** [August 21, 2023, 10:10pm UTC](https://developer.squareup.com/forums/t/node-js-sdk-response-body-vs-response-result/10400/1 "2023-08-21T22:10:26Z")

</div>

Hello. I’ve been using the node.js SDK. I’m able to output data from my server in the terminal. I’m also able to get data to the client(DOM). I’m able to do this by using `res.send(response.body)`, which is a string in the terminal, but once it gets to the client the data is an object (as expected, & desired). If I do `res.send(response)` in the server I get data in the server terminal but an error at the client. I’m wanting to know why that is because the docs mentions “response.result” & not “response.body”. Thank you!

```auto
app.get('/test', async (req, res) => {
  try {
    const response = await client.customersApi.listCustomers()
    console.log(response.result)
    res.send(response.body) // displays in server, & displays in client
    // res.send(response.result) // displays in server, throws error in client
  } catch(error) {
    console.log(error)
  }
})

```

---

<div class="post-metadata">

**Author:** ![Bryan-Square](https://sea1.discourse-cdn.com/square/forums/user_avatar/developer.squareup.com/bryan-square/32/38_2.png) [@Bryan-Square](https://developer.squareup.com/forums/u/Bryan-Square)\
**Post date:** [August 22, 2023, 12:33am UTC](https://developer.squareup.com/forums/t/node-js-sdk-response-body-vs-response-result/10400/2 "2023-08-22T00:33:10Z")

</div>

What’s the error your getting on the client? 🙂

---

<div class="post-metadata">

**Author:** ![goodjuju](https://avatars.discourse-cdn.com/v4/letter/g/dfb087/32.png) [@goodjuju](https://developer.squareup.com/forums/u/goodjuju)\
**Post date:** [August 22, 2023, 2:22am UTC](https://developer.squareup.com/forums/t/node-js-sdk-response-body-vs-response-result/10400/3 "2023-08-22T02:22:17Z")

</div>

Apologies, I misspoke. I had recently switched some things around. I’m getting an error on the server when I attempt to call `res.send(response.result)` to the client. This is the error I’m getting.

```auto
TypeError: Do not know how to serialize a BigInt
    at JSON.stringify (<anonymous>)
    at stringify (/Users/user_name/Projects/demo-node-request/node_modules/express/lib/response.js:1150:12)
    at ServerResponse.json (/Users/user_name/Projects/demo-node-request/node_modules/express/lib/response.js:271:14)
    at ServerResponse.send (/Users/user_name/Projects/demo-node-request/node_modules/express/lib/response.js:162:21)
    at /Users/user_name/Projects/demo-node-request/server.js:112:9
    at process.processTicksAndRejections (node:internal/process/task_queues:95:5)

```

This is my GET method

```auto
app.get('/test', async (req, res) => {
  try {
    const response = await client.customersApi.listCustomers()
    // res.send(response.body)
    res.send(response.result)
  } catch(error) {
    console.log(error)
  }
})

```

---

<div class="post-metadata">

**Author:** ![Bryan-Square](https://sea1.discourse-cdn.com/square/forums/user_avatar/developer.squareup.com/bryan-square/32/38_2.png) [@Bryan-Square](https://developer.squareup.com/forums/u/Bryan-Square)\
**Post date:** [August 22, 2023, 4:20pm UTC](https://developer.squareup.com/forums/t/node-js-sdk-response-body-vs-response-result/10400/4 "2023-08-22T16:20:16Z")

</div>

The SDK sometimes returns a response that includes a value that’s a [BigInt](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/BigInt). When this response is sent to a client from the server, typically using Express, it throws an error because `BigInt.prototype.toJSON` doesn’t exist. [MDN has a guide](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/BigInt#use_within_json) for working around this issue. 🙂
