Unable to see content in a parsed JSON file containing XML as values

zackhaiway

New Member
I have a JSON file like this:test.json\[code\]{ "barcode": { "message": "<?xml version=\"1.0\" encoding = \"utf-8?\"><PrintLetterBarcodeData name=\"ABCD \" gender=\"FEMALE\" yob=\"1964\"/>", "format": "PKBarcodeFormatQR", "messageEncoding": "iso-8859-1" }}\[/code\]and a PHP file like this:test.php\[code\]<?php$JSON = file_get_contents('test.json');$json_object = json_decode($JSON);print_r($json_object);?>\[/code\]I am trying to read the value for the key "message" under "barcode". I am getting an empty string. Here's what I get when I print the object.\[quote\] stdClass Object ( [barcode] => stdClass Object ( [message] => [format] => PKBarcodeFormatQR [messageEncoding] => iso-8859-1 ) )\[/quote\]JSON is good, message has XML content. I need to get read that XML content in PHP. Please let me know how I can do that?
 
Back
Top