I've JSON response body then I convert it to array use json_decode()
but when I trying loop one single array I received error
Illegal String Offset
this my json response
{
"StartDate": "2016-09-01",
"EndDate" : "2016-09-01",
"Currency" : "IDR",
"StartBalance" : "94163880.00",
"Data": [
{
"TransactionDate":"PEND",
"BranchCode":"0000",
"TransactionType":"D",
"TransactionAmount":"100000.00",
"TransactionName":"TRSF E-BANKING DB",
"Trailer":"0109/FTSCY/WS95051 100000.00 Online Transfer PT DUMMY2"
},
{
"TransactionDate":"PEND",
"BranchCode":"0061",
"TransactionType":"C",
"TransactionAmount":"3000000.00",
"TransactionName":"NK - LLG",
"Trailer":""
}
]
]
this JSON to array
$output = curl_exec($ch); // This is API Response
curl_close($ch);
$result = json_decode($output,true);
return view("bca.cekmutasi", [
"result" => $result
]);
this my view
@if (isset($result))
@foreach ($result as $key => $value)
<div class="col-xs-6">
<ul class="list-unstyled" style="line-height: 2">
<li><span class="fa fa-circle text-success"></span> TransactionDate : <b></b></li>
</ul>
</div>
@endforeach
@endif
How do I fix this ?
via Chebli Mohamed
Aucun commentaire:
Enregistrer un commentaire