Skip to content

[FEATURE] Add json_set function to PPL #3214

Closed

Description

@acarbonetto

Is your feature request related to a problem?

As part of the RFC to add JSON functions, the json_set function would be useful to set or update elements of an existing json_object.

What solution would you like?

### `JSON_SET`

**Description**

`json_set(doc, path, value [, path, value]...)` Updates existing or adds new json elements to a json document at the specified paths. Returns the updated document. 

**Arguments type:** JSON_OBJECT, STRING, STRING | JSON_OBJECT | JSON_ARRAY, ...

**Return type:** JSON_OBJECT

Example:

    os> source=people | eval updated = json_set('{"a":[{"b":1},{"b":2}]}', '$.a[*].b', 3) | head 1 | fields updated 
    fetched rows / total rows = 1/1
    +-------------------------+
    | updated                 |
    +-------------------------+
    | {"a":[{"b":3},{"b":3}]} |
    +-------------------------+

What alternatives have you considered?

N/A

Do you have any additional context?

Activity

  1. andy-k-improving commented on Jan 20, 2025

    @andy-k-improving
    Contributor

    For community awareness, I'm working on it.

  2. added
    PPL
    on May 29, 2025
  3. LantaoJin commented on Jun 16, 2025

    @LantaoJin
    Member

    Resolved by #3559 with Calcite implementation.

  4. moved this from Not Started to Done in PPL Trackeron Jun 16, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    PPLenhancement

    Type

    No type

    Projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions