Kernel::System::JSON - the JSON wrapper lib
Functions for encoding perl data structures to JSON.
create a JSON object. Do not use it directly, instead use:
my $JSONObject = $Kernel::OM->Get('Kernel::System::JSON');
Encode a perl data structure to a JSON string.
my $JSONString = $JSONObject->Encode( Data => $Data, SortKeys => 1, # (optional) (0|1) default 0, to sort the keys of the json data Pretty => 1, # (optional) (0|1) default 0, to pretty print );
Decode a JSON string to a perl data structure.
my $PerlStructureScalar = $JSONObject->Decode( Data => $JSONString, );
returns a constant that can be mapped to a boolean true value in JSON rather than a string with "true".
my $TrueConstant = $JSONObject->True(); my $TrueJS = $JSONObject->Encode( Data => $TrueConstant, );
This will return the string 'true'. If you pass the perl string 'true' to JSON, it will return '"true"' as a JavaScript string instead.
like True()
, but for a false boolean value.
This software is part of the OTRS project (https://otrs.org/).
This software comes with ABSOLUTELY NO WARRANTY. For details, see the enclosed file COPYING for license information (GPL). If you did not receive this file, see https://www.gnu.org/licenses/gpl-3.0.txt.