Page MenuHomePhabricator

Add encodeAsList to PhutilJSON and make formatting prettier
ClosedPublic

Authored by epriestley on Aug 4 2015, 7:28 PM.
Tags
None
Referenced Files
Unknown Object (File)
Fri, May 3, 9:22 AM
Unknown Object (File)
Thu, Apr 25, 2:56 AM
Unknown Object (File)
Wed, Apr 17, 3:22 PM
Unknown Object (File)
Tue, Apr 9, 2:35 AM
Unknown Object (File)
Sat, Apr 6, 11:39 PM
Unknown Object (File)
Fri, Apr 5, 10:03 PM
Unknown Object (File)
Mar 26 2024, 2:59 AM
Unknown Object (File)
Mar 6 2024, 4:11 AM
Subscribers
None

Details

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:

Screen Shot 2015-08-04 at 12.27.12 PM.png (337×622 px, 38 KB)

Diff Detail

Repository
rPHU libphutil
Branch
json1
Lint
Lint Errors
SeverityLocationCodeMessage
Errorsrc/parser/PhutilJSON.php:132XHP45PHP Compatibility
Unit
Tests Passed
Build Status
Buildable 7481
Build 8002: [Placeholder Plan] Wait for 30 Seconds
Build 8001: arc lint + arc unit

Event Timeline

epriestley retitled this revision from to Add encodeAsList to PhutilJSON and make formatting prettier.
epriestley updated this object.
epriestley edited the test plan for this revision. (Show Details)
epriestley added a reviewer: chad.
chad edited edge metadata.
This revision is now accepted and ready to land.Aug 4 2015, 7:39 PM
This revision was automatically updated to reflect the committed changes.