Page MenuHomePhabricator

Add phutil_json_decode(), for convenience
ClosedPublic

Authored by epriestley on Feb 27 2014, 8:30 PM.
Tags
None
Referenced Files
Unknown Object (File)
May 6 2025, 5:21 AM
Unknown Object (File)
May 6 2025, 5:21 AM
Unknown Object (File)
Apr 18 2025, 8:43 PM
Unknown Object (File)
Apr 1 2025, 11:14 AM
Unknown Object (File)
Mar 23 2025, 7:53 AM
Unknown Object (File)
Mar 18 2025, 5:06 PM
Unknown Object (File)
Mar 18 2025, 12:16 PM
Unknown Object (File)
Mar 14 2025, 12:34 PM
Subscribers

Details

Summary

This is just a convenience method for decoding possibly-sketchy strings. We have a lot of cases where we may try to decode some uninitialized value (like null) and then check if we got something sensible out or not.

Particularly, almost all of these can likely be simplified:

$ git grep -A1 -i 'json_decode' . | grep is_array | wc -l
33
Test Plan

Added and executed unit tests.

Diff Detail

Lint
Lint Skipped
Unit
Tests Skipped

Event Timeline

btrahan edited edge metadata.
This revision is now accepted and ready to land.Feb 27 2014, 10:08 PM