added tojson function to node spec, to control specific json representation of object