# Drone config JSON doesn't resolve double backslash '\\\\' as escape character

**URL:** <https://drone.discourse.group/t/drone-config-json-doesnt-resolve-double-backslash-as-escape-character/8375>\
**Category:** Drone Support\
**Created:** [July 8, 2021, 11:54am UTC](https://drone.discourse.group/t/drone-config-json-doesnt-resolve-double-backslash-as-escape-character/8375 "2021-07-08T11:54:48Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![mknapcok](https://yyz1.discourse-cdn.com/flex003/user_avatar/drone.discourse.group/mknapcok/32/2970_2.png) [@mknapcok](https://drone.discourse.group/u/mknapcok)\
**Post date:** [July 8, 2021, 11:54am UTC](https://drone.discourse.group/t/drone-config-json-doesnt-resolve-double-backslash-as-escape-character/8375/1 "2021-07-08T11:54:48Z")

</div>

Hi,  
I had swiched from using YAML for JSON for drone-config but I bumped into this behavior.  
What used to work in YAML as:

```auto
${DRONE_COMMIT_BRANCH//\//-}

```

is not working in JSON as:

```auto
${DRONE_COMMIT_BRANCH//\\//-}

```

I’m following [this](https://github.com/google/jsonnet/issues/679) where it’s said that I should use double backslash.

The goal is to replace `/` for `-` in commit\_branch. Let’s say I have branch `test/branch/with/slashes` and as result I’d like `test-branch-with-slashes`  
Thanks.

---

<div class="post-metadata">

**Author:** ![mknapcok](https://yyz1.discourse-cdn.com/flex003/user_avatar/drone.discourse.group/mknapcok/32/2970_2.png) [@mknapcok](https://drone.discourse.group/u/mknapcok)\
**Post date:** [July 8, 2021, 2:02pm UTC](https://drone.discourse.group/t/drone-config-json-doesnt-resolve-double-backslash-as-escape-character/8375/2 "2021-07-08T14:02:17Z")

</div>

I have a feeling that Drone is processing JSON back to YAML when build is started.  
I have my config in JSON but error message mentions yaml:…  
 ![image](https://canada1.discourse-cdn.com/flex003/uploads/testdrone/original/2X/9/980dfe1f0af67d5cf20905e1efde5e6a95a4b989.png)

If that’s the case then the problem is that from JSON to YAML the escape characters are not translated correctly.

 ![image](https://canada1.discourse-cdn.com/flex003/uploads/testdrone/original/2X/4/4fb3d87cf89e841a4962a69ae9739b68253d52ba.png)

The YAML string `${DRONE_COMMIT_BRANCH//\//-}` translated to JSON is `${DRONE_COMMIT_BRANCH////-}`

 ![image](https://canada1.discourse-cdn.com/flex003/uploads/testdrone/original/2X/f/fc7ef4ad064fd851fb18dca6ed0229f9e2adc523.png)

But this `${DRONE_COMMIT_BRANCH////-}` doesn’t work either. As the compiler can’t process that.

 ![image](https://canada1.discourse-cdn.com/flex003/uploads/testdrone/original/2X/d/d6e1a8d358fa0d4f5ce641d1cd93b9abebca0a6a.png)

I hope you understand know my strong motivation to keep using YAML instead of JSON 😃
