summaryrefslogtreecommitdiff
path: root/it.class
diff options
context:
space:
mode:
Diffstat (limited to 'it.class')
-rw-r--r--it.class4
1 files changed, 2 insertions, 2 deletions
diff --git a/it.class b/it.class
index 83e7d0e..cc53558 100644
--- a/it.class
+++ b/it.class
@@ -1260,12 +1260,12 @@ static function json_encode($data, $p = [])
}
/**
- * Decodes json data and provides warning if failed
+ * Decodes json data and provides warning if failed. Objects returned as objects by default
* $p['assoc'] Return objects as assoc arrays
*/
static function json_decode($json, $p = [])
{
- return ($data = json_decode($json, $p['assoc'])) === null && trim($json) != 'null' ? it::error((array)$p['it_error'] + ['title' => "invalid json", 'body' => $json]) : $data;
+ return ($data = json_decode($json, $p['assoc'])) === null && trim($json) != 'null' ? it::error((array)$p['it_error'] + ['title' => "invalid json: " . json_last_error(), 'body' => $json]) : $data;
}
/**