writing nodes to json