$a = json_decode($encodedData);
foreach ($a as $v) {
 $b[$v->{"国"}][$v->{"地域"}] = $v->{"人口"};
}
var_dump(json_encode($b));
あとは調整しれ
つか>>1