diff options
Diffstat (limited to 'lib/private/json.php')
-rw-r--r-- | lib/private/json.php | 13 |
1 files changed, 11 insertions, 2 deletions
diff --git a/lib/private/json.php b/lib/private/json.php index 6ba0b13806b..6a9e5a2df5e 100644 --- a/lib/private/json.php +++ b/lib/private/json.php @@ -109,7 +109,16 @@ class OC_JSON{ if($setContentType) { self::setContentTypeHeader(); } - array_walk_recursive($data, array('OC_JSON', 'to_string')); - echo json_encode($data); + echo self::encode($data); + } + + /** + * Encode JSON + */ + public static function encode($data) { + if (is_array($data)) { + array_walk_recursive($data, array('OC_JSON', 'to_string')); + } + return json_encode($data); } } |