Possible Bug: exception using Event.jsonValue

(James Yong) #1

The definition of Event.jsonValue is:

Value of the event as parsed JSON data structure

One would expect a json representation of the event to be returned.

I have a typical subscribe callback;

def attributeHandler(def e) {
log.debug(e.deviceId.toString() + " " + e.jsonValue)

When it is activated, the following exception is thrown:
8:00:47 PM: error Lexing failed on line: 1, column: 1, while reading ‘o’, no possible valid JSON value or punctuation could be recognized.

Well, as a workaround currently I’m just reading the values independently and forming a json string.

(Toejough) #2


I also had this problem when trying to read events and send them to a custom endpoint. If I form JSON manually, I can send it out just fine. If I try to use the “jsonValue” field, the data is black-holed and I never see it at my server. Pretty sure Event.jsonValue is busted.

(James Yong) #3

I’ve actually notified support regarding all the problems I’ve posted. In order of priority, actually this is the least important, other IDE usability issues are more critical and is a major pain point. I’ve to spend minutes to test, much of it waiting for the simulator, which more often than not locks up. No longer willing to subject myself to that torture, I’ll wait for it to improve. :stuck_out_tongue:

(Danny Kleinman) #4

@jamesyoung and @toejough
as an alternative, try using:


(Alex) #5

@megapixel, evt.encodeAsJSON() gives me error

groovy.lang.MissingPropertyException: No such property: encodeAsJSON for class: physicalgraph.event.Event @ line 64

How did you get it working?

Event.jsonValue also gives me the error above…