EscapeForJSON Plugin for Movable Type


EscapeForJSON v1.0 (1 KB) — 17 May 2017


JSON string encoder for Movable Type.

Usage in Movable Type templates (particularly useful for JSON feeds):

<MTEntries lastn="5">
"content_html" : "<MTEntryBody escape_for_json='1'>"

Basic JSON string escaping: \, ", whitespace and control characters.

I wrote this because MT’s built-in escape="js" and encode_js="1" tag filters are overzealous in what they escape (for example, backslash-escaping every < and >), which makes the output ugly, and a big part of JSON Feed’s appeal is that feeds look good to the human eye.

Also included: an example JSON Feed index template for Movable Type.


Unzip, and copy the “” file to the plugins directory of your Movable Type installation, e.g.:

(MT home)/plugins/