← All docs

json_validate()

Checks if a string contains valid JSON.

json_validate()

function json_validate(string $json, int $depth = 512, int $flags = 0): bool

Checks if a string contains valid JSON.

Parameters:

  • $json (string)
  • $depth (int), default 512, optional
  • $flags (int), default 0, optional

Returns: bool

No examples yet — check examples/ and showcases/ for usage patterns.

Internals

For how json_validate is implemented in the compiler, see the internals page.