Forum Discussion

acesario's avatar
acesario
Contributor II
6 years ago
Solved

JSONPath where key or value starts with @ character?

0 I am attempting get a value based on the key containing @ symbol fails using JSONPath. Cause: Since @ is the current object/element, json does not return the value. Sample 1: { “firstName”: “...
  • cjhoward18's avatar
    6 years ago

    I believe this expression will give you the filter you are looking for:

    jsonPath($.phoneNumbers, "[?(jsonPath(@, '@**type') == 'iPhone')]")

    if you’d like to collect the ‘@**type’ values then this is the expression you are looking for:

    jsonPath($.phoneNumbers, "[?(jsonPath(@, '@**type') == 'iPhone')].@**type")