By John Gruber
The first subscription service for Mac apps. No ads, paid upgrades, in-app purchases or hidden costs. Just $9.99/month.
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'>" </MTEntries>
Basic JSON string escaping:
", whitespace and control characters.
I wrote this because MT’s built-in
tag filters are overzealous in what they escape (for example,
>), 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 “EscapeJSON.pl” file to the plugins directory of your Movable Type installation, e.g.: