|
|
|
|
|
by jcampbell1
4627 days ago
|
|
Trailing commas would make the problem worse! If you allow trailing commas then you would break json parsing in all old version of IE. The unicode line ending problem is more subtle. I have seen people write code like (mix javascript and some templating): <script>
var prefs = <%= user_prefs.to_spec_conforming_json() %>;
...
The above code looks okay, but if the json is just spec conforming, then you are exposed to a potential XSS attack.Most people that write json encoders are aware of the problem, but why publish a a spec that can potentially create serious security problems? |
|
No, you would break the evaluation of json as javascript in old versions of IE.
Use a real parser already.