How to convert JSON string to array

后端 未结 14 1220
猫巷女王i
猫巷女王i 2020-11-22 03:37

What I want to do is the following:

  1. taking JSON as input from text area in php
  2. use this input and convert it to JSON and pass it to php curl to send
14条回答
  •  感动是毒
    2020-11-22 04:23

    Make sure that the string is in the following JSON format which is something like this:

    {"result":"success","testid":"1"} (with " ") .
    

    If not, then you can add "responsetype => json" in your request params.

    Then use json_decode($response,true) to convert it into an array.

提交回复
热议问题