Documentation

Json
in package

Helper functions for JSON processing.

Table of Contents

encode()  : string
Encode a JsonSerializable object, swapping out the $keys in process.
encodeArray()  : string
Encode an array of JsonSerializable objects, swapping out the $keys in the process.
jsonize()  : mixed
Take any JsonSerializable object and an array of $keys to swap out.

Methods

encode()

Encode a JsonSerializable object, swapping out the $keys in process.

public static encode(JsonSerializable $obj, array<string|int, mixed> ...$keys) : string
Parameters
$obj : JsonSerializable
$keys : array<string|int, mixed>
Return values
string

encodeArray()

Encode an array of JsonSerializable objects, swapping out the $keys in the process.

public static encodeArray(array<string|int, mixed> $objs, array<string|int, mixed> ...$keys) : string
Parameters
$objs : array<string|int, mixed>
$keys : array<string|int, mixed>
Return values
string

jsonize()

Take any JsonSerializable object and an array of $keys to swap out.

private static jsonize(JsonSerializable $obj, array<string|int, mixed> $keys) : mixed
Parameters
$obj : JsonSerializable
$keys : array<string|int, mixed>
Return values
mixed

Search results