diff options
author | Urban Müller | 2019-01-18 15:10:58 +0100 |
---|---|---|
committer | Urban Müller | 2019-01-18 15:10:58 +0100 |
commit | 2a2ba78a71918f86e94c3a21fc52e8cdfdb52b68 (patch) | |
tree | 3db098f0f38db4c9b680b2deab9c1613c0e5b654 /it.class | |
parent | 9bcb2f848b8418d646f0f2ae3c17c5a320056008 (diff) | |
download | itools-2a2ba78a71918f86e94c3a21fc52e8cdfdb52b68.tar.gz itools-2a2ba78a71918f86e94c3a21fc52e8cdfdb52b68.tar.bz2 itools-2a2ba78a71918f86e94c3a21fc52e8cdfdb52b68.zip |
allow returning assoc arrays
Diffstat (limited to 'it.class')
-rw-r--r-- | it.class | 3 |
1 files changed, 2 insertions, 1 deletions
@@ -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; } /** |