Update json.format.php
This commit is contained in:
parent
fc9459f814
commit
6713e2f654
|
@ -25,7 +25,10 @@ if(!check_function_exists("json_encode_ex")) {
|
||||||
function json_encode_ex($data, $options=array()) {
|
function json_encode_ex($data, $options=array()) {
|
||||||
$result = false;
|
$result = false;
|
||||||
|
|
||||||
if(array_key_equals("adaptive", $options, true)) {
|
$is_adaptive = array_key_equals("adaptive", $options, true);
|
||||||
|
$is_assoc = array_key_equals("assoc", $options, true);
|
||||||
|
|
||||||
|
if($is_adaptive) {
|
||||||
// 2018-06-01: Adaptive JSON is always quotes without escape non-ascii characters
|
// 2018-06-01: Adaptive JSON is always quotes without escape non-ascii characters
|
||||||
$lines = array();
|
$lines = array();
|
||||||
foreach($data as $k=>$v) {
|
foreach($data as $k=>$v) {
|
||||||
|
@ -36,6 +39,8 @@ if(!check_function_exists("json_encode_ex")) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
$result = "{" . implode(",", $lines) . "}";
|
$result = "{" . implode(",", $lines) . "}";
|
||||||
|
} elseif($is_assoc) {
|
||||||
|
$result = json_encode($data, true);
|
||||||
} else {
|
} else {
|
||||||
$result = json_encode($data);
|
$result = json_encode($data);
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue
Block a user