Fixed json parsing. Added writing nodes to json.