Last active
August 29, 2015 14:10
-
-
Save dphiffer/63a0e5a5ef8d627b1135 to your computer and use it in GitHub Desktop.
A dumb conversion utility for PHP <=> JSON
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<form action="serialize.php" method="post"> | |
<p>JSON:<br> | |
<textarea name="json" rows="10" cols="80"><?php | |
if (!empty($_POST['php'])) { | |
echo json_encode(unserialize($_POST['php']), JSON_PRETTY_PRINT | JSON_UNESCAPED_SLASHES); | |
} | |
?></textarea></p> | |
<p>Serialized PHP:<br> | |
<textarea name="php" rows="10" cols="80"><?php | |
if (!empty($_POST['json'])) { | |
echo serialize(json_decode($_POST['json'], true)); | |
} | |
?></textarea></p> | |
<input type="submit"> | |
</form> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment