<? Php <br/> function json_to_array ($ web) {<br/> $ arr = array (); <br/> foreach ($ web as $ k => $ V) {<br/> If (is_object ($ V) $ arr [$ K] = json_to_array ($ V ); // determine whether the type is an object <br/> else $ arr [$ K] = $ V; <br/>}< br/> return $ arr; <br/>}< br/> $ S = '{"webname": "homehf", "url": "www.homehf.com", "QQ": "744348666 "}'; <br/> // convert the character to JSON <br/> $ web = json_decode ($ S); <br/> $ arr = array (); <br/> foreach ($ web as $ k => $ v) <br/> $ arr [$ K] = $ V; <br/> echo "<PRE>"; <br/> print_r ($ ARR); <br/> echo "</PRE> "; </P> <p> $ S = '{"webname": "homehf", "url": "www.homehf.com", "Contact": {"QQ ": "744348666", "mail": "nieweihf@163.com", "XX": "xxxxxxx" }}'; <br/> $ web = json_decode ($ S ); <br/> $ arr = json_to_array ($ Web); <br/> echo "<PRE>"; <br/> print_r ($ ARR ); <br/> echo "</PRE> "; </P> <p> /******************************** **************************************** <br/> ************************************ **********************************/<br/> $ S = '{"webname ": "homehf", "url": "www.homehf.com", "Contact": {"QQ": "744348666", "mail": "nieweihf@163.com", "XX ": "xxxxxxx" }}'; <br/> $ web = json_decode ($ S); <br/> echo 'website name :'. $ web-> webname. '<br/> URL :'. $ web-> URL. '<br/> contact information: QQ -'. $ web-> contact-> QQ. 'mail :'. $ web-> contact-> mail; <br/> echo '<br/> '; <br/> /*********************************** *********************************** <br/> *************************************** ********************************/<br/> $ s = '{"webname ": "homehf", "url": "www.homehf.com", "Contact": {"QQ": "744348666", "mail": "nieweihf@163.com", "XX ": "xxxxxxx" }}'; <br/> $ web = json_decode ($ S); <br/> echo json_encode ($ Web); <br/>