summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--lib/private/json.php4
1 files changed, 3 insertions, 1 deletions
diff --git a/lib/private/json.php b/lib/private/json.php
index 8401f7c3a12..6a9e5a2df5e 100644
--- a/lib/private/json.php
+++ b/lib/private/json.php
@@ -116,7 +116,9 @@ class OC_JSON{
* Encode JSON
*/
public static function encode($data) {
- array_walk_recursive($data, array('OC_JSON', 'to_string'));
+ if (is_array($data)) {
+ array_walk_recursive($data, array('OC_JSON', 'to_string'));
+ }
return json_encode($data);
}
}