You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Inconsistent behaviour when keys include backslash #3
1.\t is a control character (tab) so the double backslash is retained, this would seem correct behaviour.
2.\t (tab) would be retained in the key, which would seem correct behaviour.
3. \d does not represent a control character so Ruby strips out the backslash when it creates the hash and before it gets passed to CompactData.generate, this is demonstrated here:
3.0.0 :012 > {"a\d":1}
=> {:ad=>1}
In the following example, we create a hash with one pair; the key is key\\key and value is value\\value
This is the output from JSON.generate
{"key\\key":"value\\value"}
This is the output from CompactData.generate:
key\key=value\value
Here are some questions for consideration:
Should the backslash in the CompactData string be escaped too?
Activity