/    Sign up×
Community /Pin to ProfileBookmark

How to use Foreach Loop To Print Out A Json Data

How can i loop through this json array structure and print out the data in it

“{“archivedOrdertransactionsdata”:{“e”:”get_order_tx”,
“ok”:”ok”,
“data”:{
“id”:”xxxxxxxxxxx”,
“type”:”sell”,
“time”:1564513209101,
“lastTxTime”:1564513209101,
“lastTx”:”9684024199″,
“pos”:null,
“user”:”xxxxxxxxx”,
“status”:”d”,
“symbol1″:”BTC”,
“symbol2″:”USD”,
“amount”:”-0.00205078″,
“remains”:”0.00000000″,
“tfa:USD”:”0.05″,
“tta:USD”:”19.80″,
“a:BTC:cds”:”0.00205078″,
“a:USD:cds”:”19.80″,
“f:USD:cds”:”0.05″,
“tradingFeeTaker”:”0.25″,
“tradingFeeStrategy”:”userVolumeAmount”,
“tradingFeeUserVolumeAmount”:”408256″,
“orderId”:”xxxxxxxxxxx”,”next”:false,
“vtx”:[
{“id”:”9684024199″,
“type”:”sell”,
“time”:”2019-07-30T19:00:09.101Z”,
“user”:”xxxxxxx”,
“c”:”user:up125383961:a:BTC”,
“d”:”order:xxxxxxxxxxx:a:BTC”,
“a”:”0.00000000″,
“amount”:”-0.00205078″,
“balance”:”0.00000000″,
“symbol”:”BTC”,
“order”:”xxxxxxxxxxx”,
“buy”:null,
“sell”:null,
“pair”:null,
“pos”:null,
“office”:”UK”,
“cs”:0,
“ds”:0},
{
“id”:”xxxxxxxxx”,
“type”:”sell”,
“time”:”2019-07-30T19:00:09.101Z”,
“user”:”xxxxxxx”,
“c”:”user:xxxxxxxxx:a:USD”,
“d”:”order:xxxxxxxxxxx:a:USD”,
“a”:”19.75000000″,
“amount”:”19.75000000″,
“balance”:”19.76000000″,
“symbol”:”USD”,
“order”:”xxxxxxxxxxx”,
“buy”:”9684013492″,
“sell”:”xxxxxxxxxxx”,
“pair”:null,
“pos”:null,
“office”:”UK”,
“cs”:”19.76″,
“ds”:0,
“price”:9655.4,
“symbol2″:”BTC”,
“fee_amount”:”0.05″}
]}}}” string(1291)
{“archivedOrdertransactionsdata”:{“e”:”get_order_tx”,
“ok”:”ok”,
“data”:{
“id”:”xxxxxxxxxxx”,
“type”:”sell”,
“time”:1564513209101,
“lastTxTime”:1564513209101,
“lastTx”:”9684024199″,
“pos”:null,
“user”:”xxxxxxx”,
“status”:”d”,
“symbol1″:”BTC”,
“symbol2″:”USD”,
“amount”:”-0.00205078″,
“remains”:”0.00000000″,
“tfa:USD”:”0.05″,
“tta:USD”:”19.80″,
“a:BTC:cds”:”0.00205078″,
“a:USD:cds”:”19.80″,
“f:USD:cds”:”0.05″,
“tradingFeeTaker”:”0.25″,
“tradingFeeStrategy”:”userVolumeAmount”,
“tradingFeeUserVolumeAmount”:”408256″,
“orderId”:”xxxxxxxxxxx”,”next”:false,
“vtx”:[
{“id”:”9684024199″,
“type”:”sell”,
“time”:”2019-07-30T19:00:09.101Z”,
“user”:”xxxxxxxxxxxx”,
“c”:”user:xxxxxxxxx:a:BTC”,
“d”:”order:xxxxxxxxxxx:a:BTC”,
“a”:”0.00000000″,
“amount”:”-0.00205078″,
“balance”:”0.00000000″,
“symbol”:”BTC”,
“order”:”xxxxxxxxxxx”,
“buy”:null,
“sell”:null,
“pair”:null,
“pos”:null,
“office”:”UK”,
“cs”:0,
“ds”:0},
{
“id”:”xxxxxxxxxxxxxxxxx”,
“type”:”sell”,
“time”:”2019-07-30T19:00:09.101Z”,
“user”:”xxxxxxxxxx”,
“c”:”user:up125383961:a:USD”,
“d”:”order:xxxxxxxxxxx:a:USD”,
“a”:”19.75000000″,
“amount”:”19.75000000″,
“balance”:”19.76000000″,
“symbol”:”USD”,
“order”:”xxxxxxxxxxx”,
“buy”:”9684013492″,
“sell”:”xxxxxxxxxxx”,
“pair”:null,
“pos”:null,
“office”:”UK”,
“cs”:”19.76″,
“ds”:0,
“price”:9655.4,
“symbol2″:”BTC”,
“fee_amount”:”0.05″}
]}}}” string(1291)


to post a comment
PHP

1 Comments(s)

Copy linkTweet thisAlerts:
@NogDogDec 12.2019 — I'd probably start by loading into a PHP array, after which you can loop through it with your typical foreach() loops and such.
<i>
</i>$data = json_decode($your_json_string, true);

(I generally prefer to add the second true argument so that everything is an array, rather than a mix of arrays and objects.)
×

Success!

Help @charles_D_PHP_BENDER spread the word by sharing this article on Twitter...

Tweet This
Sign in
Forgot password?
Sign in with TwitchSign in with GithubCreate Account
about: ({
version: 0.1.9 BETA 4.25,
whats_new: community page,
up_next: more Davinci•003 tasks,
coming_soon: events calendar,
social: @webDeveloperHQ
});

legal: ({
terms: of use,
privacy: policy
});
changelog: (
version: 0.1.9,
notes: added community page

version: 0.1.8,
notes: added Davinci•003

version: 0.1.7,
notes: upvote answers to bounties

version: 0.1.6,
notes: article editor refresh
)...
recent_tips: (
tipper: @Yussuf4331,
tipped: article
amount: 1000 SATS,

tipper: @darkwebsites540,
tipped: article
amount: 10 SATS,

tipper: @Samric24,
tipped: article
amount: 1000 SATS,
)...