Here’s the response from webserver received by Device Handler:
482768ca-b09a-497c-b997-a4b51f720c45 3:55:13 PM: debug JSON: [“Door2Vld”:0, “Door1Vld”:1, “Door0Vld”:1]
My DH Code:
def parse(String description) {
log.debug “Parsing ‘${description}’”
def msg = parseLanMessage(description)
def headersAsString = msg.header // => headers as a string
def headerMap = msg.headers // => headers as a Map
def body = msg.body // => request body as a string
def status = msg.status // => http status code of the response
def json = msg.json // => any JSON included in response body, as a data structure of lists and maps
def xml = msg.xml // => any XML included in response body, as a document tree structure
def data = msg.data // => either JSON or XML in response body (whichever is specified by content-type header in response)
log.debug "Receiving Message From Device: " + status + " body: " + body
log.debug "JSON: " + json;
def parseResult = JsonSlurper.parseText(json) //<<--- Error message point to this line
log.debug "Door0Vld: " + parseResult.Door0Vld
log.debug "Door1Vld: " + parseResult.Door1Vld
log.debug "Door2Vld: " + parseResult.Door2Vld
I’m Getting the following error message:
482768ca-b09a-497c-b997-a4b51f720c45 3:55:13 PM: error groovy.lang.MissingMethodException: No signature of method: static groovy.json.JsonSlurper.parseText() is applicable for argument types: (java.util.HashMap) values: [[“Door2Vld”:0, “Door1Vld”:1, “Door0Vld”:1]]
Am I missing something? TIA!!