Created
January 21, 2014 10:02
-
-
Save pistatium/8537401 to your computer and use it in GitHub Desktop.
XMLからJSON形式への変換メモ(PHP) ref: http://qiita.com/pistatium@github/items/7cfcd4ccb91c6f4c43e9
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
$obj = simplexml_load_string($xml); | |
$json = json_encode($obj); |
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
$obj = simplexml_load_string($xml, NULL, LIBXML_NOCDATA); | |
$json = json_encode($obj); |
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
<items> | |
<item>Hoge</item> | |
</items> |
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
<items> | |
<item>Hoge</item> | |
<item>Fuga</item> | |
</items> |
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
{"item":"Hoge"} |
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
{"item":["Hoge","Fuga"]} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment