Documentation

JsonExtract
in package

Json Extract expression class

Tags
category

Pop

author

Nick Sagona, III nick@popphp.org

copyright

Copyright (c) 2009-2026 Nick Sagona, III

license

https://www.popphp.org/license New BSD License

version
7.0.0

Table of Contents

Properties

$rendered  : string
The rendered, dialect-specific extraction expression

Methods

__construct()  : mixed
Constructor
__toString()  : string
Render the expression string
parsePathSegments()  : array<string|int, mixed>
Parse a MySQL-style JSONPath string ('$.foo.bar', '$.tags[0]') into an ordered list of path segments ('foo', 'bar' / 'tags', '0'), for dialects (PostgreSQL) that address by segment array rather than JSONPath syntax directly

Properties

$rendered

The rendered, dialect-specific extraction expression

protected string $rendered

Methods

__construct()

Constructor

public __construct(AbstractSql $sql, string $column, string $path) : mixed

Instantiate the JSON extract expression object. Renders immediately - this object is immutable once built, unlike Select, whose state can still change after construction.

Parameters
$sql : AbstractSql
$column : string
$path : string
Tags
throws
Exception

__toString()

Render the expression string

public __toString() : string
Return values
string

parsePathSegments()

Parse a MySQL-style JSONPath string ('$.foo.bar', '$.tags[0]') into an ordered list of path segments ('foo', 'bar' / 'tags', '0'), for dialects (PostgreSQL) that address by segment array rather than JSONPath syntax directly

public static parsePathSegments(string $path) : array<string|int, mixed>
Parameters
$path : string
Return values
array<string|int, mixed>

        
On this page

Search results