access json object and array

前端 未结 2 498
日久生厌
日久生厌 2021-01-03 13:16

Here is my JSON data :

{
  \"Liste_des_produits1\": [{
    \"Added_Time\": \"28-Sep-2009 16:35:03\",
    \"prod_ingredient\": \"sgsdgds\",
    \"prod_danger         


        
相关标签:
2条回答
  • 2021-01-03 13:38

    Use json_decode

    Then you can access the data as a regular array.

    0 讨论(0)
  • 2021-01-03 13:59

    Use json_decode to convert the data to an associative array.

    $data = json_decode($jsonString, true);
    
    // extend this concept to access other values
    $prod_ingredient = $prod['Liste_des_produits1'][0]['prod_ingredient'];
    
    0 讨论(0)
提交回复
热议问题