Groovy web console

subscribe to the feed Subscribe
to this
site
exemple data bts (via #groovywebconsole)
tweet this snippet Tweet
this
script

exemple data bts

Published 3 weeks ago by rh
Actions  ➤ Edit in console Back to console Show/hide line numbers View recent scripts
import groovy.json.JsonSlurper

//def data  = '''{"root": {"second": [{"array":"titi"}, {"array":"toto"}]}}'''

def data_test =  ''' {"scan_data_2g"  :{"cells": [{
    "arfcn": "valuearfcn",
    "band": "valband",
   "rssi": "valrssi",
    "snr": "valsnr",
    "plmn": "valplmn",
    "lac": "vallac",
    "cell_id": "valcell",
    "bcc": "valbcc",
    "ncc": "valncc",
    "c1": "valc1",
     "c2": "valc2",
    "arfcn_neighbors":[]
 }]
}
}'''


def slurper = new JsonSlurper()

def parsed = slurper.parseText(data_test)

parsed?.scan_data_2g?.cells?.each { arg1 ->
    println arg1.arfcn
}

return null