XML 

https://www.codeproject.com/Articles/1222133/Reading-and-Writing-XML-in-Csharp-VB-Net

https://www.codeproject.com/Articles/15593/Read-and-write-Open-XML-files-MS-Office

https://www.codeproject.com/Articles/670141/Read-and-Write-Microsoft-Excel-with-Open-XML-SDK

https://www.codeproject.com/Articles/245595/Read-Write-Remove-Create-XML

JSON

https://www.codeproject.com/Articles/1201466/Working-with-JSON-in-Csharp-VB

 

public static string Serialize<T>(T obj)
{
    DataContractJsonSerializer serializer = new DataContractJsonSerializer(obj.GetType());
    MemoryStream ms = new MemoryStream();
    serializer.WriteObject(ms, obj);
    string retVal = Encoding.UTF8.GetString(ms.ToArray());
    return retVal;
}

public static T Deserialize<T>(string json)
{
    T obj = Activator.CreateInstance<T>();
    MemoryStream ms = new MemoryStream(Encoding.Unicode.GetBytes(json));
    DataContractJsonSerializer serializer = new DataContractJsonSerializer(obj.GetType());
    obj = (T)serializer.ReadObject(ms);
    ms.Close();
    return obj;
}

You'll need:

using System.Runtime.Serialization;

using System.Runtime.Serialization.Json;