I have a simple JSON file:
{
"json.transactionDetails":{
"transactionDate":1266518024,
"transactionType":"bought",
"userDescription":"reimbursement",
"transactionDescription":"Bought 10 AAPL @200",
"quantity":10,
"amount":"2010.00",
"price":"200.00",
"commission":"10.00",
}
}
Then a PHP file getting the JSON:
$t_detail = file_get_contents("details.json");
$transaction_detail = json_decode($t_detail);
$tr_detail = $transaction_detail->json.transactionDetails; //this is my issue
$transaction_type = $tr_detail->transactionType;
$user_description = $tr_detail->userDescription;
How do I parse the "json.transactionDetails"? The period is causing my script to fail. If I remove the "json." from both scripts everything works fine. Is there a way to skip over the first object in the tree or what? I can't change the way the JSON is outputted because it's coming from and external API.