Answer the question
In order to leave comments, you need to log in
How to check that the elements in json are sorted by a specific attribute?
How to check that the elements in json are sorted by a specific attribute, for example, by color:
I need something like
assert(isSort([{id:5, color:red}, {id:8, color:blue}{id:9 , color:blue}{id:2, color:green}])) = false
assert(isSort([{id:9, color:blue}, {id:8, color:blue}{id:2, color: green}{id:5, color:red}])) = true
Need a groovy or java solution or hints how to do it..
Answer the question
In order to leave comments, you need to log in
the first thing that comes to mind is to implement this functionality in the model
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question