# Ansible Json filter

**URL:** <https://forum.ansible.com/t/ansible-json-filter/27618>\
**Category:** Ansible Project\
**Tags:** aws\
**Created:** [May 24, 2018, 6:18pm UTC](https://forum.ansible.com/t/ansible-json-filter/27618 "2018-05-24T18:18:13Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![Ankur\_Gupta](https://avatars.discourse-cdn.com/v4/letter/a/f05b48/32.png) [@Ankur\_Gupta](https://forum.ansible.com/u/Ankur_Gupta)\
**Post date:** [May 24, 2018, 6:18pm UTC](https://forum.ansible.com/t/ansible-json-filter/27618/1 "2018-05-24T18:18:13Z")

</div>

Hello All,

I have a situation where i am trying to remove key: value from json output. but i am not getting expected result. Please help me what I am doing wrong here?

```auto
 "get_ec2_id.instances[0].tags": {
    "Name": "test-db-system-2",
    "aws:cloudformation:logical-id": "DBInstance",
    "aws:cloudformation:stack-id": "arn:aws:cloudformation:us-east-1:123456789012:stack/test-db-system-2/0115v0a0-5d44-17e8-a024-503ama4a5qd1",
    "aws:cloudformation:stack-name": "test-db-system-2",
    "dbsystem:stack": "test-db-system-2",
    "dbsystem:type": "db"
}

```

I am trying to remove the all “aws:cloudformation” tags using below filter:

```auto
"{{ get_ec2_id.instances[0].tags | reject('search','aws:') }}"

```

I am getting the below result:

```auto
ok: [10.52.8.101] => {
"instances_tags": [
    "dbsystem:type",
    "dbsystem:stack",
    "Name"
]
    }

```

but I am expected below result :

```auto
 "instances_tags": [
    "dbsystem:stack": "test-db-system-2",
    "dbsystem:type": "db"
    "Name" : "test-db-system-2",
]
  }

```

Help me to solve the issue.
