properly serialize and parse event data