문제

I'm using JSON::XS, and I'm getting some weird output from an encoding of some file paths.

To create the output, I just call encode_json on some data that I get from calling a dir command from perl (using ``). Which I save in an array.

I end up with a JSON string that looks like the following:

 "\"E: \\\\helm\\\\Layman1\\n\""

Where are the extra backslashes coming from?

도움이 되었습니까?

해결책

A \ character has special meaning in JSON. To represent one as data in JSON it must be expressed as an escape sequence: \\.

라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top