PHP将字符串对象转换为JSON数组

时间:2016-06-14 13:12:12

标签: php arrays json

我该如何转换

$shipmentDet = '{"{\"Coupon\": \"\", \"PromotionName\": \"FREE Tighty Wifey\", \"DiscountAmount\": 23.75}","{\"Coupon\": \"get20\", \"PromotionName\": \"GET20\", \"DiscountAmount\": 20}"}'

我需要使用PHP将字符串对象转换为JSON数组。

我使用了json_decode()但是,它无法正常工作

$shipmentRec = (array)json_decode($shipmentDet, true);

1 个答案:

答案 0 :(得分:-1)

$ result = json_decode($ shipmentDet,true);

相关问题