Skip to Main Content

BTD_Mod_Helper​.Api​.Helpers​.ModelSerializer


BloonsTD6 Mod Helper

BTD_Mod_Helper.Api.Helpers

ModelSerializer Class

Handles serializing and deserializing models in a way that utilizes their actual constructors

public static class ModelSerializer

Inheritance System.Object  ModelSerializer

Methods

ModelSerializer.DeserializeModel(JObject, Type) Method

Recreates a model from serialized JSON, attempting to exactly recreate its types and references

public static object DeserializeModel(JObject jObject, System.Type type);

Parameters

jObject Newtonsoft.Json.Linq.JObject

Serialized model JSON

type System.Type

The type of Model to deserialize this as

Returns

System.Object

ModelSerializer.DeserializeModel(JObject) Method

Recreates a model from serialized JSON, attempting to exactly recreate its types and references

public static T DeserializeModel<T>(JObject jObject)
    where T : Model;

Type parameters

T

The type of Model to deserialize this as

Parameters

jObject Newtonsoft.Json.Linq.JObject

Serialized model JSON

Returns

T

ModelSerializer.DeserializeModel(string) Method

Recreates a model from serialized JSON, attempting to exactly recreate its types and references

public static T DeserializeModel<T>(string text)
    where T : Model;

Type parameters

T

The type of Model to deserialize this as

Parameters

text System.String

Serialized model JSON string

Returns

T

ModelSerializer.SerializeModel(Model) Method

Serializes a model to JSON, preserving types and references

public static string SerializeModel(Model model);

Parameters

model Il2CppAssets.Scripts.Models.Model

Returns

System.String

To learn how to download BTD Mod Helper and install mods, click here