Support JSON-encoded options and backslash escapes.

This matches PHP commit https://gerrit.wikimedia.org/r/114163

Change-Id: Id05d01d1a8261694db6e9b25ce9ae13cf1507f6b
Merge "Support JSON-encoded options and backslash escapes."