You are here

function oa_export_json_decode_objects in Open Atrium Export 7.2

Recursively convert arrays back to objects.

Parameters

array $array: An array that contains arrays which may contain a special key we set in the export.

Return value

array An array with all objects, that were converted to arrays in the export, converted back to objects.

1 call to oa_export_json_decode_objects()
oa_export_json_import in formats/json.inc
Import callback.

File

formats/json.inc, line 96
The OA export JSON format handler.

Code

function oa_export_json_decode_objects($array) {
  if (is_array($array)) {
    foreach ($array as $k => $v) {
      if (is_array($v)) {
        $array[$k] = oa_export_json_decode_objects($v);
      }
    }
    if (isset($array['#oa_export_object'])) {
      unset($array['#oa_export_object']);
      $array = (object) $array;
    }
    return $array;
  }
}