$json = json_decode($data);$source = new DOMDocument();
$source->loadXml($json->CountryList);
$xpath = new DOMXpath($source);
$target = new DOMDocument();
$options = $target->appendChild($target->createElement('select'));
foreach ($xpath->evaluate('/Countries/Country') as $country) {
$countryCode = $xpath->evaluate('string(Code)', $country);
$countryName = $xpath->evaluate('string(Name)', $country);
$option = $options->appendChild(
$target->createElement('option')
);
$option->setAttribute('value', $countryCode . "|" . $countryName);
$option->appendChild($target->createTextNode($countryName));
}
$target->formatOutput = TRUE;
echo $target->saveXml($options);
<select>
<option value="AF|Afghanistan">Afghanistan</option>
<option value="AL|Albania">Albania</option>
<option value="DZ|Algeria">Algeria</option>
<option value="AS|American Samoa">American Samoa</option>
<option value="AD|Andorra">Andorra</option>
<option value="AO|Angola">Angola</option>
<option value="AI|Anguilla">Anguilla</option>
<option value="AQ|Antarctica">Antarctica</option>
<option value="AG|Antigua & Barbuda">Antigua & Barbuda</option>
<option value="AR|Argentina">Argentina</option>
<option value="AM|Armenia">Armenia</option>
<option value="AW|Aruba">Aruba</option>
<option value="AU|Australia">Australia</option>
<option value="AT|Austria">Austria</option>
<option value="AZ|Azerbaijan">Azerbaijan</option>
<option value="BS|Bahamas">Bahamas</option>
<option value="BH|Bahrain">Bahrain</option>
<option value="BD|Bangladesh">Bangladesh</option>
<option value="BB|Barbados">Barbados</option>
<option value="BY|Belarus (Belorussia)">Belarus (Belorussia)</option
</select>