T
T
Tatyana2015-07-20 11:21:56
Java
Tatyana, 2015-07-20 11:21:56

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

1 answer(s)
O
Oleg Gamega, 2015-07-20
@gadfi

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 question

Ask a Question

731 491 924 answers to any question