Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[LR] getFromJson without array wrapper #2495

Open
ittaLaRedoute opened this issue Oct 10, 2023 · 2 comments
Open

[LR] getFromJson without array wrapper #2495

ittaLaRedoute opened this issue Oct 10, 2023 · 2 comments

Comments

@ittaLaRedoute
Copy link

Hello,

We would like to get elements with getFromJson without the array wrapper []
Example:
{ "firstName": "John", "lastName": "doe", "age": 26, "address": { "streetAddress": "naist street", "city": "Nara", "postalCode": "630-0192" }, "phoneNumbers": [ { "type": "iPhone", "number": "0123-4567-8888" }, { "type": "home", "number": "0123-4567-8910" } ] }

With this Json path: $.phoneNumbers[0].number

What we currently get:
["0123-4567-8888"]

What we want to get:

"0123-4567-8888"

What we normally do is use a getFromGroovy property to remove the square brackets and get exacly the value we want.

This is blocking for us because we have several values that we want to retreive from different services responses and use in the request of a different service.

For instance, for the test that I'm working on, I need to retrieve more than 24 values.

Is it possible to add this modification to the getFromJson property?

Thank you in advance.

@vertigo17
Copy link
Member

Seems very relevant to me.
The only big warning is that such a change will need test refactoring when deployed.
We will probably need to manage that change of behaviour with a new parameter that will allow users to desactivate it until the refactoring effort is done.

@ittaLaRedoute
Copy link
Author

ok, noted, thank you!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants