<?php
header('Access-Control-Allow-Origin: *');
//header('Content-Type: application/json');

include ("..\jsondata.php");
$arr = json_decode($jsonData, TRUE);
//print_r($arr);

$record = array_filter($arr, function($rec) {
    //receiving parameter
    $id = $_GET['id'];
    if ($rec['id'] == $id) {
        echo json_encode(array( array('id'=> $rec['id'], 'name'=> $rec['name'], 'reg'=> $rec['reg'], 'area'=> $rec['area'], 'type'=> $rec['type']) ));
        die();
    }
    //return $rec['id'] == $id;
});

//var_dump($record);
echo json_encode($record);

?>