Forum Discussion
alex_panganiban
4 years agoContributor
I think as an alternative to using the null safe access feature, you could also use the hasPath() and get() methods. I like using the get() a little more because if the path doesn’t exist, then it will automatically assign a null to the result of the expression, whereas the hasPath() method renders a true or false result. If you use hasPath(), then you’ll probably want to incorporate it as part of a ternary expression.
Here’s a few conceptual examples for you.
Related Content
- 2 years ago
- 2 years ago