/** * JSON encoder function (Also does the UTF8 encoding) * * @param {object} $object */ public static function jsonEncode($object) { if (is_object($object)) { $object = Arrays::objectToArray($object); } if (is_array($object)) { array_walk_recursive($object, array('TinyQueries\\Api', 'toUTF8')); } else { $object = self::toUTF8($object); } return json_encode($object); }