Skip to content

jsonb_apply

Apply text functions recursively to JSONB string values

jsonb_apply · Apply text functions recursively to JSONB string values

Overview

IDExtensionPackageVersionCategoryLicenseLanguage
102120jsonb_applyjsonb_apply0.1.0FEATC

Usage

Sources:

jsonb_apply recursively transforms JSONB strings by invoking a named PostgreSQL text function. It preserves the document structure and non-string values.

Core Workflow

CREATE EXTENSION jsonb_apply;
SELECT jsonb_apply('{"name":"Alice","tags":["hello"]}'::jsonb, 'upper');
SELECT jsonb_apply('{"message":"hello"}'::jsonb, 'replace', 'hello', 'bye');

Operational Boundaries

The function takes a JSONB document, a function name and optional variadic arguments. The called function must accept text as its first argument and return text; its other argument types participate in overload resolution. Use reviewed function names and appropriate schema visibility, since this invokes SQL functions rather than a fixed list of transformations.

Install the C library and create the extension as a superuser. No preload or restart is specified. The reviewed source publishes neither a PostgreSQL-major support matrix nor a license declaration; the catalog does not assert either.

Table reader