Finish writing to JSON and add writing to XML