Home >Backend Development >PHP Tutorial >How to convert JSON data format to PHP array

How to convert JSON data format to PHP array

小云云
小云云Original
2018-03-12 15:06:211565browse

This article mainly shares with you how to convert JSON data format into PHP array, I hope it can help you.

<?php
$str=<<<str
        [
{
"value": 30,
"color":"#F38630"
},
{
"value" : 50,
"color" : "#E0E4CC"
},
{
"value" : 100,
"color" : "#69D2E7"
}
 
]
str;
//通过json_decode方法将json格式的字符串转换为数组
$arr=json_decode($str,true);
var_dump($arr);
die;
?>

Related recommendations:

List parsing - How to convert python list strings into php arrays

The above is the detailed content of How to convert JSON data format to PHP array. For more information, please follow other related articles on the PHP Chinese website!

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn