Skip to content

JMESPath - Merge function can't merge when receiving a json_const_ref #702

@BartelNieuwenhuyse

Description

@BartelNieuwenhuyse

JMESPath expressions in which the merge function is used may give the following error if the first argument of the merge function is of storage kind json_const_ref. This because the insert_or_assign method is not implemented for storage kind json_const_ref:

Attempting to access a member of a value that is not an object

Various JMESPath functions produce a json_const_ref, so if one of these is used as input to a merge function, the JMESPath expression doesn't work:

  • map
  • projections (object, list, flatten, slice, filter)
  • multi select list and hash

Enumerate the steps to reproduce the bug
given:

{ "foz": "baz" }

expression with, for example, a multi select hash:
{ object: @ }.merge(object, { foo: 'bar' })

expected:

{ "foo": "bar", "foz": "baz" }

actual:
error Attempting to access a member of a value that is not an object: 'foo'

What jsoncons library version?

  • Latest release 1.7.0
  • Other release ______
  • master

Metadata

Metadata

Assignees

No one assigned

    Labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions