how to mount the json of that call

Asked

Viewed 66 times

0

I’m having a problem I don’t know how to build the json of this call in php to send by Curl someone could help me?

"auto_recurring": {
        "frequency": 1,
        "frequency_type": "months",
        "transaction_amount": 200
 }
  • 1

    This already seems to be part of a valid JSON format, What’s the problem?

  • I want to play this in the php array to mount a request to be sent to the market paid by Curl. was searching and to send json by Curl in php and I need to transform this json into array, but I have no idea how to do this

  • Then it is duplicated here: https://answall.com/questions/109460/como-guardar-o-valor-dos-%C3%adndices-desse-json-em-Vari%C3%a1vel (there are several others on the site doing this, it is worth a search)

  • @you need to provide more information, so that someone can really understand what you intend to do, and try to help you in something, according to what you said in the post and with what you commented it is not clear which problem needs to solve

  • Good vamus la I need to supply these parameters to the paid market the way it is there. I’ve been searching on the Internet and the way you send those by curl for paid market and in an array, however how to mount that array? I thought to mount so : array('auto_recurring' => 'frequency' => 1, 'auto_recurring' => 'frequency_type' => 'months') so on but I don’t know if that’s how it mounts to send by curl for the market this and my doubt

  • I’ve already solved my problem

  • You can delete the question or post the solution.

Show 2 more comments

1 answer

0

Do so:

$array = [
    "auto_recurring" =>[
        "frequency" => 1,
        "frequency_type" => "months",
        "transaction_amount" => 200
    ]
];

After you want to convert to json do the following:

json_encode($array);

The output of the above row is:

"auto_recurring": {
        "frequency": 1,
        "frequency_type": "months",
        "transaction_amount": 200
 }

Browser other questions tagged

You are not signed in. Login or sign up in order to post.