Skip to content
Advertisement

How to assign to a new array an array of objects?

I can’t figure out how I would do the ff.

I have the ff. Payload

JavaScript

And I just want to get the acctId params and assign it to a new plain array of accountIds. How do I do it in Spring/Java?. Thanks

Advertisement

Answer

Try using json path. Library can be found here. E.g. say you had json like this:

JavaScript

Actual code would be something like:

JavaScript

The above list will now hold:

JavaScript

If you wanna learn json path syntax, you could try using this online tool. Here is also a guide to help you get started with json path.

Advertisement