Q:

How to add _ to white spaces in json objects?

I am loading json this way:
  $json = file_get_contents("world_ita.json");
  $data = json_decode($json, true);

But the file has "United States" or "British Islands"
I need to parse the doc in order to replace all white spaces with an underscore and have it:
United_States or British_Islands

A:

$output = str_replace(' ', '_', $input);

