In your question you have a string of Unicode characters 6 "\", "u", "0", "4", "2", "3"( my_hash = { "my_str" => '\u0423' }), rather than a string of 1 ""character ( "\u0423", note the double quotes).
RFC 4627, 2.5, JSON , JSON.pretty_generate.
, escape- . , , , , "\\".
char = unescaped /
escape (...
%x5C / ; \ reverse solidus U+005C
escape = %x5C ; \
, JSON ruby gem , JSON JSON.pretty_generate.
JSON gem - '\' char:
module JSON
MAP = {
...
'\\' => '\\\\'
JSON gem gem install json_pure ( , C, gem install json).
: JSON, , , :
my_hash = { "my_str" => '\u0423' }
json = JSON.pretty_generate(my_hash)
res = json.gsub "\\\\", "\\"
, !