Add a JSON object passing mechanism

This commit is contained in:
Dan Hawkins 2021-11-16 17:40:47 +00:00
commit 037f00fab6

22
hardware/sominfo.groovy Normal file
View file

@ -0,0 +1,22 @@
def sominfo = null
def String asJsonText() {
return writeJSON(returnText: true, json: sominfo, pretty: 1)
}
def boolean isSet() {
return (sominfo != null)
}
def set(String jsontext) {
sominfo = readJSON(text: jsontext)
def som_support_json_text = writeJSON(returnText: true, json: sominfo, pretty: 1)
echo "Som support info:\n${asJsonText()}"
}
def get() {
return sominfo
}
return this