[Solved] Populate select option with JSON file

Anele Asks: Populate select option with JSON file
I am having a problem with populating a select dropdown from a JSON file. I am modifying an existing plugin, and I want to include countries that we want to see to.

The JSON FILE​

Code:
{
 "AX": {
    "name": "Åland Islands",
    "lpa": "18",
    "affirm_non_muslim": false
 },
 "AF": {
    "name": "Afghanistan",
    "lpa": "0",
    "affirm_non_muslim": false
 },
 "AL": {
    "name": "Albania",
    "lpa": "18",
    "affirm_non_muslim": false
 },
 "DZ": {
    "name": "Algeria",
    "lpa": "18",
    "affirm_non_muslim": false
 }
}

MY FUNCTION FILE​

Code:
function av_get_json_data(){

    $json_url = require( plugin_dir_path( __FILE__ ) . '../includes/data/country_age.json' );
    $args   = array('timeout' => 120);
    $json_feed = wp_remote_get( $json_url, $args );

    $json_string_in_array = array('$json_feed');
    $json_array = json_decode($json_string_in_array[0]);

    //$actual_feed  = json_decode($json_array);
    return $json_array;
}

Here is the output form​

Code:
$form .= '</select> <select name="av_verify_l" id="av_verify_l">';

        foreach (av_get_json_data() as $data) :
            $form .= '<option value="" >' . $data . '</option>';
        endforeach;
        $form .='<select>';

FRONT-END OUTPUT​


Screenshot from 2017-01-20 19:21:17.png

QUESTION​

How can I output the JSON file countries in the dropdown

Ten-tools.com may not be responsible for the answers or solutions given to any question asked by the users. All Answers or responses are user generated answers and we do not have proof of its validity or correctness. Please vote for the answer that helped you in order to help others find out which is the most helpful answer. Questions labeled as solved may be solved or may not be solved depending on the type of question and the date posted for some posts may be scheduled to be deleted periodically. Do not hesitate to share your response here to help other visitors like you. Thank you, Ten-tools.