Skip to content

Add traverse operation #21

Open
Open
@chuwy

Description

@chuwy

I see it as a response on this old blog post: http://susanpotter.net/blogs/software/2011/07/why-json-pointer-falls-short/ (which is about JSON Pointer and querying, but for our use-case Patch and modifying is more important, nevertheless I'd be happy to hear about state of art for querying)

Basically, given this input array:

{
  "fooArray": [{"foo": 1}, {"foo": 2}, {"foo": 2}, {"foo": 1}],
  "nonArray": null
}

and following imaginary operation:

{
  "op": "traverse", "path": "/fooArray", "value": [
    { "op": "replace", "path": "/foo", "value": 42 },
  ]
}

would produce:

{
  "fooArray": [{"foo": 42}, {"foo": 42}, {"foo": 42}, {"foo": 42}],
  "nonArray": null
}

traverse here should roughly correspond to map (I like this name even more) from FP-languages.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions