Groovy web console

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

exemple data bts

Published 1 year 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",

def slurper = new JsonSlurper()

def parsed = slurper.parseText(data_test)

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

return null