Skip to content

API reference

JsonFast exposes static methods only. Data-returning methods accept an optional $output argument (output modes).

Constants

Validation & diagnostics

MethodDescription
validate()Quick boolean check — is this valid JSON?
inspect()Valid/invalid plus error line and column
analyse()Full diagnostic with suggested repair flags

Repair & encoding

MethodDescription
repair()Fix malformed JSON with a repair flag bitmask
unwrap()Peel double- or triple-encoded JSON strings

Format

MethodDescription
beautify()Pretty-print with configurable indent
minify()Compact JSON or parsed value

Path access

MethodDescription
get()Read a single dot/bracket path
has()Check whether a path exists
search()Collect values matching a wildcard path
extract()Read multiple paths in one call

Transform

MethodDescription
merge()Deep-merge two documents
diff()Structural diff between two documents

Schema

MethodDescription
getSchema()Infer JSON Schema from a document
validateSchema()Validate JSON against a schema
applySchema()Apply defaults and strip extra properties
schemaDiff()Diff two schema documents

Global notes

  • Schema validation implements a focused subset of JSON Schema (type, required, properties, items, default) — not the full draft spec.
  • Path wildcards ([*]) work in search(), not in get().
  • beautify() with OUTPUT_STRING preserves indent; other methods return compact JSON strings.
  • OUTPUT_OBJECT maps JSON objects to stdClass; JSON arrays remain PHP arrays.

Native tools, weird experiments, and practical performance work.