Use toJson() and convert to js object

Signed-off-by: Joern Bernhardt <jb@campudus.com>