summaryrefslogtreecommitdiff
path: root/it.class
diff options
context:
space:
mode:
authorUrban Müller2019-01-18 15:10:58 +0100
committerUrban Müller2019-01-18 15:10:58 +0100
commit2a2ba78a71918f86e94c3a21fc52e8cdfdb52b68 (patch)
tree3db098f0f38db4c9b680b2deab9c1613c0e5b654 /it.class
parent9bcb2f848b8418d646f0f2ae3c17c5a320056008 (diff)
downloaditools-2a2ba78a71918f86e94c3a21fc52e8cdfdb52b68.tar.gz
itools-2a2ba78a71918f86e94c3a21fc52e8cdfdb52b68.tar.bz2
itools-2a2ba78a71918f86e94c3a21fc52e8cdfdb52b68.zip
allow returning assoc arrays
Diffstat (limited to 'it.class')
-rw-r--r--it.class3
1 files changed, 2 insertions, 1 deletions
diff --git a/it.class b/it.class
index 89d799a..8209e65 100644
--- a/it.class
+++ b/it.class
@@ -1138,10 +1138,11 @@ static function json_encode($data)
/**
* Decodes json data and provides warning if failed
+ * $p['assoc'] Return objects as assoc arrays
*/
static function json_decode($json, $p = [])
{
- return ($data = json_decode($json)) === null && $json != 'null' ? it::error((array)$p['it_error'] + ['title' => "invalid json", 'body' => $json]) : $data;
+ return ($data = json_decode($json, $p['assoc'])) === null && $json != 'null' ? it::error((array)$p['it_error'] + ['title' => "invalid json", 'body' => $json]) : $data;
}
/**