BASE . LOG,
'log_file_id' => $LOG_FILE_ID,
'log_per_date' => true,
]);
$json_class = 'CoreLibs\Convert\Json';
// define a list of from to color sets for conversion test
$PAGE_NAME = 'TEST CLASS: JSON';
print "";
print "
" . $PAGE_NAME . "";
print "";
print '';
print '' . $PAGE_NAME . '
';
$json = '{"foo": "bar"}';
$output = Json::jsonConvertToArray($json);
print "S::JSON: $json: " . DgS::printAr($output) . "
";
print "S::JSON ERROR: " . Json::jsonGetLastError() . ": " . Json::jsonGetLastError(true) . "
";
$json = '["f: {b"""ar}]';
$output = Json::jsonConvertToArray($json);
print "S::E-JSON: $json: " . DgS::printAr($output) . "
";
print "S::E-JSON ERROR: " . Json::jsonGetLastError() . ": " . Json::jsonGetLastError(true) . "
";
print "S::E Validate: " . Json::jsonValidate($json) . ": " . Json::jsonGetLastError(true) . "
";
// direct
$json = '{"direct": "static function call"}';
$output = $json_class::jsonConvertToArray($json);
print "J/S::JSON: $json: " . DgS::printAr($output) . "
";
print "J/S::JSON ERROR: " . $json_class::jsonGetLastError() . ": " . $json_class::jsonGetLastError(true) . "
";
$json = '["f: {b"""ar}]';
$output = $json_class::jsonConvertToArray($json);
print "J/S::E-JSON: $json: " . DgS::printAr($output) . "
";
print "J/S::E-JSON ERROR: " . $json_class::jsonGetLastError() . ": " . $json_class::jsonGetLastError(true) . "
";
// $json = '{"foo": "bar"}';
// $output = Jason::jsonConvertToArray($json);
// print "S::JSON: $json: " . DgS::printAr($output) . "
";
// print "S::JSON ERROR: " . Jason::jsonGetLastError() . ": " . Jason::jsonGetLastError(true) . "
";
// convert an array to json
$array = ['foo' => 'bar'];
$output = Json::jsonConvertArrayTo($array);
print "S::JSON: " . DgS::printAr($array) . " => " . $output . "
";
$array = ['foo' => 'bar', 'sub' => ['other' => 'this', 'foo' => 'bar', 'set' => [12, 34, true]]];
print "Pretty: " . Json::jsonPrettyPrint($array) . "
";
print "";
// __END__