json_encode()
function json_encode(mixed $value, int $flags = 0, int $depth = 512): string
Returns the JSON representation of a value.
Parameters:
$value(mixed)$flags(int), default0, optional$depth(int), default512, optional
Returns: string
Availability
- Compiled (AOT): supported by the Elephc code generator.
eval()(magician interpreter): supported — declarative interpreter builtin (crates/elephc-magician/src/interpreter/builtins/json/json_encode.rs).
No examples yet — check examples/ and showcases/ for usage patterns.
Internals
For how json_encode is implemented in the compiler, see the internals page.