mirror of
https://github.com/yawaflua/spworlds-csharp-library.git
synced 2025-12-08 19:49:32 +02:00
23 lines
540 B
C#
23 lines
540 B
C#
using Newtonsoft.Json;
|
|
using System;
|
|
using System.Collections.Generic;
|
|
using System.Linq;
|
|
using System.Text;
|
|
using System.Threading.Tasks;
|
|
|
|
namespace spworlds
|
|
{
|
|
internal class Deserialize
|
|
{
|
|
public static T DeserializeObject<T>(string data) where T : class
|
|
{
|
|
T objectToReturn = JsonConvert.DeserializeObject<T>(data);
|
|
if (objectToReturn == null)
|
|
throw new Exception("User not player.");
|
|
else
|
|
return objectToReturn;
|
|
|
|
}
|
|
}
|
|
}
|