static void EscreveOutput(PrevisaoIPMA leitura) { string jsonData = JsonConvert.SerializeObject(leitura); File.WriteAllText(@"../outputs/" + leitura.globalIdLocal + ".json", jsonData); XmlDocument xmlDocument = JsonConvert.DeserializeXmlNode(jsonData, "root"); xmlDocument.Save(@"../outputs/" + leitura.globalIdLocal + ".xml"); }
static PrevisaoIPMA LerFicheiroPrevisao(int globalID) { String jsonString = null; using (StreamReader reader = new StreamReader(@"../data_forecast/" + globalID + ".json")) jsonString = reader.ReadToEnd(); PrevisaoIPMA obj = System.Text.Json.JsonSerializer.Deserialize <PrevisaoIPMA>(jsonString); return(obj); }