Add encodeAsList to PhutilJSON and make formatting prettier
Summary:
Ref T8973. Ref T7419. Two issues:
- In documenting T7419, I want to pretty print a JSON list value (an example value for lint and unit when calling harbormaster.sendmessage). Expose a public method for this.
- T8973 discusses PHP's default behavior of escaping forward slashes in JSON. This is legal, but cumbersome. When pretty-printing for human users, disable it if we have a recent-enough PHP version.
Test Plan:
- See next diffs.
- Pretty-printed lists with values that contain slashes, got friendly/helpful results:
{F688892}
Reviewers: chad
Reviewed By: chad
Maniphest Tasks: T7419, T8973
Differential Revision: https://secure.phabricator.com/D13787