Rollup merge of #77890 - gilescope:welformed-json-output-from-libtest, r=KodrAus
Rollup merge of #77890 - gilescope:welformed-json-output-from-libtest, r=KodrAus

Fixing escaping to ensure generation of welformed json.

doc tests' json name have a filename in them. When json test output is asked for on windows currently produces invalid json.
Tracking issue for json test output: #49359

graydon/rust,graydon/rust,aidancully/rust,graydon/rust,aidancully/rust,aidancully/rust,graydon/rust,graydon/rust,graydon/rust,aidancully/rust,aidancully/rust,aidancully/rust