# How to pass string with backslash at end to json\_query

**URL:** <https://forum.ansible.com/t/how-to-pass-string-with-backslash-at-end-to-json-query/3374>\
**Category:** Get Help\
**Tags:** windows, collections\
**Created:** [January 18, 2024, 1:27pm UTC](https://forum.ansible.com/t/how-to-pass-string-with-backslash-at-end-to-json-query/3374 "2024-01-18T13:27:20Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![dhiraam](https://avatars.discourse-cdn.com/v4/letter/d/f08c70/32.png) [@dhiraam](https://forum.ansible.com/u/dhiraam)\
**Post date:** [January 18, 2024, 1:27pm UTC](https://forum.ansible.com/t/how-to-pass-string-with-backslash-at-end-to-json-query/3374/1 "2024-01-18T13:27:20Z")

</div>

Below is the JSON output text from a command, trying to fetch FullName and FileVersionRaw where FullName not contains ‘\msvc\’

`{ "windows_result.output": [{ "FullName": "E:\\\\app\\\\client\\\\product\\\\client\\\\bin\\\\file.txt", "Mode": "-a----", "Target": [], "VersionInfo": { "FileVersionRaw": "19.0.0.0", "ProductVersionRaw": "0.0.0.0" } }, { "FullName": "E:\\\\app\\\\client\\\\product\\\\msvc\\\\vc10\\\\file.txt", "Mode": "-a----", "Target": [], "VersionInfo": { "FileVersionRaw": "19.0.0.0", "ProductVersionRaw": "0.0.0.0" } } ] }`

Below code produces result as we search only for string ‘\\msvc’ which starts with backslash

`- name: Print result - Windows debug: msg: "{{ windows_result.output | to_json | from_json | json_query(client_path) }}" vars: client_path: "[? !contains(FullName,'\\msvc')].{FullName: FullName, FileVersionRaw: VersionInfo.FileVersionRaw}" `

Result output:

` "msg": [{ "FileVersionRaw": "19.0.0.0", "FullName": "E:\\\\app\\\\client\\\\product\\\\client\\\\bin\\\\file.txt" }]`

However if string modified to ‘\\msvc\\’ to search msvc between backslashes, \’ at end considered as escape for single quote and throws error. Please help.

```auto
type or paste code here

```
