File writing works now. Writes proper JSON.