How to receive JSON object via POST method

0 votes

I have the following code:

{
"order": {
    "id": "5RTQNACF",
    "created_at": "2012-12-09T21:23:41-08:00",
    "status": "completed",
    "total_btc": {
        "cents": 100000000,
        "currency_iso": "BTC"
    },
    "total_native": {
        "cents": 1253,
        "currency_iso": "USD"
    },
    "custom": "order1234",
    "receive_address": "1NhwPYPgoPwr5hynRAsto5ZgEcw1LzM3My",
    "button": {
        "type": "buy_now",
        "name": "Alpaca Socks",
        "description": "The ultimate in lightweight footwear",
        "id": "5d37a3b61914d6d0ad15b5135d80c19f"
    },
    "transaction": {
        "id": "514f18b7a5ea3d630a00000f",
        "hash": "4a5e1e4baab89f3a32518a88c31bc87f618f76673e2cc77ab2127b7afdeda33b",
        "confirmations": 0
    }
}
}


I want to retrieve it as Json, so how I do it?

Aug 28, 2018 in Blockchain by digger
• 26,740 points
869 views

1 answer to this question.

0 votes

You need to decode it with json_decode() like this

$json = json_decode($jsonString);

That will give you an object and then you can use it like this

 echo $json->order->total_btc->cents;
answered Aug 28, 2018 by slayer
• 29,370 points

Related Questions In Blockchain

0 votes
1 answer

How to send JSON object from npm module to browser

A simple solution for this would be ...READ MORE

answered Sep 20, 2018 in Blockchain by digger
• 26,740 points
655 views
0 votes
1 answer

How to transact custom token instead of ethers using JSON rpc?

First create your custom token. Then develop ...READ MORE

answered Jul 10, 2018 in Blockchain by digger
• 26,740 points
1,072 views
+1 vote
3 answers

Removing double quotes from a string from JSON response in PHP

Just remove the json_encode call, and it should work: $resp ...READ MORE

answered Sep 12, 2018 in Blockchain by digger
• 26,740 points
45,219 views
0 votes
1 answer

How do I add multiple recipients for transactions via Blockchain API?

Convert the recipes into JSON objects. x = ...READ MORE

answered Jul 6, 2018 in Blockchain by Perry
• 17,100 points
886 views
0 votes
1 answer

Cant connect Jsonrpc to bitcoin.

I tried the following code and it ...READ MORE

answered Aug 20, 2018 in Blockchain by digger
• 26,740 points
1,008 views
0 votes
1 answer

Bitcoind server connection problem

Be sure to allow your server ip ...READ MORE

answered Aug 23, 2018 in Blockchain by digger
• 26,740 points
950 views
0 votes
1 answer

How to receive Json callback?

Try using $get = file_get_contents("php://input"); READ MORE

answered Aug 29, 2018 in Blockchain by slayer
• 29,370 points
1,151 views
0 votes
1 answer

How to track changes of an object in exonum?

You have to describe each component in ...READ MORE

answered Jul 23, 2018 in Blockchain by slayer
• 29,370 points
633 views
webinar REGISTER FOR FREE WEBINAR X
REGISTER NOW
webinar_success Thank you for registering Join Edureka Meetup community for 100+ Free Webinars each month JOIN MEETUP GROUP