PHP 将json格式数据转换成数组的方法

php将json数据转换为数组的方法非常简单,php自带的json_decode()就可以实现,但是记住参数后面加上true,返回的便是数组,如果不加返回的便是对象

//json格式数据
$data = '{"angle":0,"card_region":[{"x":292,"y":1619},{"x":2705,"y":1809},{"x":2584,"y":3457},{"x":87,"y":3159}],"config_str":"{\"side\":\"back\"}","end_date":"20220717","is_fake":false,"issue":"海兴县公安局","request_id":"7F235F3A-B0D5-4419-A04D-932B684E4864","start_date":"20120717","success":true}';
//转换成数组
$result_str= json_decode($data,true);
//输出
var_dump($result_str);

 
  

你可能感兴趣的:(php,json,java)