# How to remove curly braces of the response body using tests

**URL:** <https://community.postman.com/t/how-to-remove-curly-braces-of-the-response-body-using-tests/52708>\
**Category:** Help Hub\
**Tags:** tests\
**Created:** [October 2, 2023, 7:56pm UTC](https://community.postman.com/t/how-to-remove-curly-braces-of-the-response-body-using-tests/52708 "2023-10-02T19:56:00Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![rajpostmanacc](https://avatars.discourse-cdn.com/v4/letter/r/22d042/32.png) [@rajpostmanacc](https://community.postman.com/u/rajpostmanacc)\
**Post date:** [October 2, 2023, 7:56pm UTC](https://community.postman.com/t/how-to-remove-curly-braces-of-the-response-body-using-tests/52708/1 "2023-10-02T19:56:00Z")

</div>

How do I remove the curly braces in the JSON response body  
example response :  
{  
“id”: “12345”,  
“store”: “walmart”,  
“location”: “newyork”  
}

How to store the above json into a variable by removing the curly braces in tests tab?

---

<div class="post-metadata">

**Author:** ![xk0der](https://sea2.discourse-cdn.com/getpostman/user_avatar/community.postman.com/xk0der/32/2056_2.png) [@xk0der](https://community.postman.com/u/xk0der)\
**Post date:** [October 2, 2023, 9:51pm UTC](https://community.postman.com/t/how-to-remove-curly-braces-of-the-response-body-using-tests/52708/2 "2023-10-02T21:51:07Z")

</div>

@rajpostmanacc👋 Welcome to the community!

Not sure if you are really looking to “remove” curly braces, but I guess you are after parsing the response data.

This question has been asked a few times already, so you may want to check those out: [Search results for 'parse JSON response' - Postman Community](https://community.postman.com/search?q=parse%20JSON%20response)

You can use the Postman’s `pm.response` object’s functions to read and manipulate the response.

_For your specific case the following should work:_

```auto
let resJson = pm.response.json(); // Parse JSON response and store in a variable

```

_You can now use it as follows:_

```auto
console.log(resJson.store); // Should print `Walmart` based on your example data

```

I suggest your check out the other community posts on [response parsing](https://community.postman.com/search?q=parse%20response), as well as this Postman learning centre doc [Test script examples | Postman Learning Center](https://learning.postman.com/docs/writing-scripts/script-references/test-examples/#parsing-response-body-data) to better your understanding on how to handle responses in scripts.

---

<div class="post-metadata">

**Author:** ![michaelderekjones](https://sea2.discourse-cdn.com/getpostman/user_avatar/community.postman.com/michaelderekjones/32/14819_2.png) [@michaelderekjones](https://community.postman.com/u/michaelderekjones)\
**Post date:** [October 3, 2023, 10:00am UTC](https://community.postman.com/t/how-to-remove-curly-braces-of-the-response-body-using-tests/52708/3 "2023-10-03T10:00:09Z")

</div>

If you remove the curly brackets, then this will no longer be a valid JSON object.

If you want this as a single variable, you would keep it as it currently looks (with the curly brackets) and store this by using JSON.stringify() and then when you want to retrieve it, you would JSON.parse().

In order to give you a better response, we need to know a bit more about the use case. What are you going to do with this? I’m guessing you need to use part of it, or all of it in a subsequent request?

---

<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:** [November 2, 2023, 10:00am UTC](https://community.postman.com/t/how-to-remove-curly-braces-of-the-response-body-using-tests/52708/4 "2023-11-02T10:00:43Z")

</div>

Closed on November 2, 2023, 10:00am UTC

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