# Accessing a JSON object with special Characters

**URL:** <https://community.postman.com/t/accessing-a-json-object-with-special-characters/18223>\
**Category:** Help Hub\
**Created:** [December 4, 2020, 5:12am UTC](https://community.postman.com/t/accessing-a-json-object-with-special-characters/18223 "2020-12-04T05:12:24Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![skydart](https://avatars.discourse-cdn.com/v4/letter/s/7feea3/32.png) [@skydart](https://community.postman.com/u/skydart)\
**Post date:** [December 4, 2020, 5:12am UTC](https://community.postman.com/t/accessing-a-json-object-with-special-characters/18223/1 "2020-12-04T05:12:24Z")

</div>

Hi,

I’m trying to access a specific value and the JSON object has a special character (@) and I’m lost about how to get a value within the object.

 ![Screen Shot 2020-12-04 at 12.04.32 AM](https://us1.discourse-cdn.com/getpostman/original/3X/0/6/06822cd525c0939d5a4a55956d4698a3697b8a0f.png)

I’ve tried this:

// save the Etag into an collection variable

let response = pm.response.json().items[0];

let key = response.PreferredFlag.@context.key;

pm.collectionVariables.set(“eEtag”, key);

console.log(“eEtag”,pm.collectionVariables.get(“eEtag”));

But it errors.

New at this and already over my head.

Jeff

---

<div class="post-metadata">

**Author:** ![praveendvd](https://sea2.discourse-cdn.com/getpostman/user_avatar/community.postman.com/praveendvd/32/6796_2.png) [@praveendvd](https://community.postman.com/u/praveendvd)\
**Post date:** [December 4, 2020, 8:00am UTC](https://community.postman.com/t/accessing-a-json-object-with-special-characters/18223/2 "2020-12-04T08:00:51Z")

</div>

let response = pm.response.json().items[0];

response[’@context’].key

---

<div class="post-metadata">

**Author:** ![bpricilla](https://sea2.discourse-cdn.com/getpostman/user_avatar/community.postman.com/bpricilla/32/6511_2.png) [@bpricilla](https://community.postman.com/u/bpricilla)\
**Post date:** [December 4, 2020, 10:04am UTC](https://community.postman.com/t/accessing-a-json-object-with-special-characters/18223/3 "2020-12-04T10:04:08Z")

</div>

Hello @skydart Welcome to Community 🙂

Since you mentioned you are new to this, I suggest you to print the response in console and try to debug from it.

To reach the intended element, it will help you understand about the array. Here why would you need to access ‘PreferredFlag’ tag for getting the key.

So it should be

```auto
let key = response.@context.key;

```

But the special characters in the tag name will cause an error and you can try what @praveendvd mentioned.

To know more about Dot and Bracket notation for JS, Please go through this:

> **[Working with objects - JavaScript | MDN](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Guide/Working_with_Objects#Objects_and_properties)**
>
> JavaScript is designed on a simple object-based paradigm. An object is a collection of properties, and a property is an association between a name (or key) and a value. A property's value can be a function, in which case the property is known as a...
