06-21-2024 05:22 AM
Hi,
We have an array of the following structure:
{
Solved! Go to Solution.
06-21-2024 05:58 AM
Thanks @koryknick - this might just be the simplistic genius i was looking for!
06-21-2024 05:34 AM
@nickhumble - could you simply enable the "Null-safe access" option and always reference the values you're looking for? If it doesn't exist, it will just be a null value. This would bypass the need for the get() method, which as you have found out, can't be used under multiple levels of object nesting.
06-21-2024 05:58 AM
Thanks @koryknick - this might just be the simplistic genius i was looking for!
06-21-2024 05:37 AM
If that doesn't work for you, then try this:
$.get('/position/field_2354910', {}).get('value')
Since the Object.get() method allows you to provide a default if the field doesn't exist, this example returns an empty object, so calling the next get() on the empty object will also return null.
Hope this helps!
06-21-2024 06:00 AM
Thanks - my problem was i couldn't get a non-null value using .get, no matter what i tried. I wondered whether the forward slashes were confusing it or something, but .hasPath worked ok so i'm a bit stumped.
Your earlier suggestion has worked well though - thank you.