Здравствуйте! Имеется такая структура JSON.
{
"Items": [
{
"Sequence": 0,
"Type": "Text",
"Message": "Some text 0"
},
{
"Sequence": 1,
"Type": "Text",
"Message": "Some text 1"
},
{
"Sequence": 2,
"Type": "CheckBox",
"Message": "Some checkbox text 2"
},
{
"Sequence": 3,
"Type": "CheckBox",
"Message": "Some checkbox text 3"
}
]
}
Я хочу все это дело перевести в массив такого вида: [ [Type,Message], [Type,Message]...], внутренние элементы, которого будут отсортированы по значению Sequence (см. выше)
[
["Text", "Some text 0"],
["Text", "Some text 1"],
["CheckBox", "Some checkbox text 2"],
["CheckBox", "Some checkbox text 3"]
]
JSON получаю через Jmeter. На данный момент есть только это:
import groovy.json.JsonSlurper
JsonSlurper JSON = new JsonSlurper ()
def jsonResponse = null
try {
jsonResponse = JSON.parseText(response)
} catch (Exception e) {
failureMessage += "Invalid JSON.\n"
}
jsonResponse.DisclosureItems.each {
}
Спасибо!
ЗЫ Я тестировщик, только начал разбираться с программированием, но пока еще крайне слаб.