Forum Discussion

walkerline117's avatar
walkerline117
Contributor
8 years ago
Solved

Jsonpath to get value with @

I have below json body, how would I use jsonpath in a mapper to get all 'name’s? Its easier for me if the json have ‘name’ instead of ‘@name’… Not sure how to get all those values in a mapper {...
  • tstack's avatar
    8 years ago

    I’m not quite sure what you’re asking, can you give an example of the output you want?

    If you’re asking how to reference a field with a special character, like the @ symbol, you can quote it like so:

    ['@name']

    If you want to collect all the ‘@name’ values at any level, you can do:

    jsonPath($, "$..['@name']")

    That will return a list containing all the values.