Fetching data from Key Value JSON object

This question already has an answer here:

  • Parsing values from a JSON file? 7 answers

  • Try this :

    $response=json_decode($json,true);
    
    echo $amount=$response['Body']['stkCallback']['CallbackMetadata']['Item']['0']['Value'];
    echo $TransactionDate=$response['Body']['stkCallback']['CallbackMetadata']['Item']['1']['Value'];
    echo $PhoneNumber=$response['Body']['stkCallback']['CallbackMetadata']['Item']['2']['Value'];
    

    You have all the values in variables now.

    链接地址: http://www.djcxy.com/p/38060.html

    上一篇: JLS中有关于执行静态初始化块顺序的任何保证吗?

    下一篇: 从键值JSON对象获取数据