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

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:

${DRONE_COMMIT_BRANCH//\//-}

is not working in JSON as:

${DRONE_COMMIT_BRANCH//\\//-}

I’m following this 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.

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

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

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

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

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