flori/json — Issue #122: Encoding Ruby string with '#{', '#@', or '#$' adds characters to JSON
Author: futuremint
Created: 2012-02-14 17:12:36+00:00
State: open

Due to Ruby's escaping the above character sequences in strings the generated JSON can't be parsed.

I would submit a patch or suggest a fix but I really have no good suggestions other than maybe a second pass after encoding for those specific sequences which is slow.

``` ruby
JSON.generate ['#$'] # => "[\"\#$\"]"
```

' ["#$"]' is valid JSON, whereas '["\\#$"]' throws syntax errors in some parsers.