json 转php array问题!着急!200分!

来源:百度知道 编辑:UC知道 时间:2024/05/25 19:11:55
[{0:{s_id:'1999',name:'元素'},1:{s_id:'2049',name:'时韵'},2:{s_id:'2050',name:'里程'},3:{s_id:'2051',name:'CIVIC'},4:{s_id:'2927',name:'pilot'},5:{s_id:'2857',name:'insight'},6:{s_id:'2904',name:'S2000'}}]

//就是类似于上面格式的json如何转换成array php
不要说用json_decode啊
根本不行的!!!!
如果给出解决方案的话 我加200分!!
全给你了

//======================================================test.php
<?php
include('json.class.php');

$json_str = "[{0:{s_id:'1999',name:'元素'},1:{s_id:'2049',name:'时韵'},2:{s_id:'2050',name:'里程'},3:{s_id:'2051',name:'CIVIC'},4:{s_id:'2927',name:'pilot'},5:{s_id:'2857',name:'insight'},6:{s_id:'2904',name:'S2000'}}]";

$json = new MY_JSON();

echo $json_str;
echo '<hr><pre>';
var_dump($json->decode($json_str));
echo '</pre><hr>';
?>
//===============================================json.class.php
//
<?php define('MY_JSON_SLICE', 1); define('MY_JSON_IN_STR', 2); define('MY_JSON_IN_ARR', 3); define('MY_JSON_IN_OBJ', 4); define('MY_JSON_IN_CMT', 5); define('MY_JSON_LOOSE_TYPE', 16); define(