esnme/ultrajson — pull request #71 by benjamn (2013-01-10 19:49:30+00:00)
Title: Support optional unicode escaping of <, >, and & characters

This pull request improves on https://github.com/esnme/ultrajson/pull/70 (which I will close).

The default is not to do any special escaping.

Pass encode_html_chars=True to ujson.encode to enable escaping.

Conditional logic is used only when <, >, or & characters are encountered, so there should be zero additional overhead for strings without any of those characters.

If you like this approach, great! If not, I don't want to keep wasting your time, and I will find another way to solve my problems.