2016-11-17 04:15
浏览 176


So I have this JSON string:

"{"Jan": [5, 10, 15, 20] , 
 {"title":"Test Chart - Month v Value"}"

I am trying to extract the data so that I can access each one so that I can iterate through the array and sequentially output the data.

The best way I can think of is to simply create an array of arrays in PHP, store key and its values together and do a nested for loop. So the array should look like this:

[[Jan, 5, 10, 15, 20],[Feb, 20, 10, ,22], [Mar, 5, 3, , 4]]

Lastly I would like to know how to store this title value into its own variable.

图片转代码服务由CSDN问答提供 功能建议


 “{”  Jan“:[5,10,15,20],
” 四月“:[10,”“,1,2] 
 {”title“:”测试图表 - 月份v值“}”


我能想到的最好的方法是简单地在PHP中创建一个数组数组,将键及其值存储在一起并执行嵌套for循环。 所以数组应如下所示:

  [[Jan,5,10,15,20],[Feb,20,10,22],[Mar,5]  ,3,,4]] 


  • 写回答
  • 好问题 提建议
  • 追加酬金
  • 关注问题
  • 邀请回答

4条回答 默认 最新

相关推荐 更多相似问题