php字符串转换成json格式

这是字符串 {"id":"shunfeng","name":"顺丰快递","order":"023499317996","message":"","errcode":"0000","status":4,"data":[{"time":"2015-07-30 19:26:29","content":"顺丰速运 已收取快件"},{"time":"2015-07-30 21:08:57","content":"快件正转运至下一站"},{"time":"2015-07-30 21:46:10","content":"快件到达 【北京紫竹院集散中心】"},{"time":"2015-07-30 21:53:26","content":"快件正转运至下一站"},{"time":"2015-07-31 00:02:41","content":"快件到达 【北京首都机场集散中心2】"},{"time":"2015-07-31 00:06:18","content":"快件正转运至 【石家庄高开集散中心】"},{"time":"2015-07-31 07:50:01","content":"快件到达 【石家庄高开集散中心】"},{"time":"2015-07-31 09:21:55","content":"快件正转运至 【石家庄红旗服务点】"},{"time":"2015-07-31 11:06:08","content":"快件到达 【石家庄红旗服务点】"},{"time":"2015-07-31 11:13:46","content":"正在派送途中,请您准备签收(派件人:宋超,电话:13831156512)"},{"time":"2015-07-31 11:39:24","content":"已签收,感谢使用顺丰,期待再次为您服务"},{"time":"2015-07-31 11:39:24","content":"在官网"运单资料&签收图",可查看签收人信息"}]}

3个回答

如果你用php解析json,可以参考
http://www.ruanyifeng.com/blog/2011/01/json_in_php.html
如果你用java解析,java自己有JSONObject,或者用谷歌的gson

你这本身就是json格式啊

qq_22630169
我林 用php转换成这样   object(stdClass)#1 (5) {        ["a"] => int(1)     ["b"] => int(2)     ["c"] => int(3)     ["d"] => int(4)     ["e"] => int(5)      }
接近 5 年之前 回复

用php转换成这样

  object(stdClass)#1 (5) {
  
    ["a"] => int(1)
    ["b"] => int(2)
    ["c"] => int(3)
    ["d"] => int(4)
    ["e"] => int(5)
  
  }
 

Csdn user default icon
上传中...
上传图片
插入图片
抄袭、复制答案,以达到刷声望分或其他目的的行为,在CSDN问答是严格禁止的,一经发现立刻封号。是时候展现真正的技术了!
立即提问
相关内容推荐