JSONPath query

0 votes
asked Oct 23, 2023 in Question / help by Samuel Ramos
reshown Oct 23, 2023

Can I use a dynamic string to query JSON data like below?

!foreach $key in $files.spec
  entity $key.title {
    !$json_data = %load_json($path + "/" + $key.filename)

       ' JSONPath = $json_data.components.schemas.UserRegisterRequest.properties       !$dynamic_path = components.schemas.UserRegisterRequest.properties
        !$properties = $json_data[$dynamic_path]

    !foreach $property in %get_json_keys($properties)
     * $property
    !endfor
  }
!endfor

Thanks,

SR

Your answer

Your name to display (optional):
Privacy: Your email address will only be used for sending these notifications.
Anti-spam verification:

[Antispam2 Feature: please please wait 1 or 2 minutes (this message will disappear) before pressing the button otherwise it will fail](--------)
To avoid this verification in future, please log in or register.
...