The free JsonNet asset is included within the Utility Modules, as certain modules use Json for file persistence or server communication. Json is an efficient text based format to save information with, much like XML, and is often used as a standard for communication from and to outside the game.
Within DuskModules, JsonNet is used by any module working with data. Main examples are DataControl and ServerConnect. This module adds the scripting definition symbol JSON_NET to your project. JsonNet has no dependencies. This module is based off of this asset store plugin, wrapped up into a DuskModule for ease of integration.
You can only convert serializable objects to Json and back. MonoBehaviours, Texture2Ds, Materials, ByteStreamers, etc cannot be converted without data loss. The best way to use this is to create a serializable wrapper object, and contain all your save data within it. You can reference other serializable objects within the wrapper object to create a tree-structure of serializable data. By converting the root wrapper object to JsonText, you can save all data within. Converting it back to an object effectively loads the data.
The default JsonUtility of Unity also provides this functionality. The main difference between this and that is that JsonNet can include the class type within the json string. This ensures that you don’t need to know its exact contents when deserializing it. This allows you to work with inheritance of serializable classes.
A few extension methods are included in the module in addition to the base json net plugin, so any object or string can be easily converted with the correct settings:
object.ToJsonText() converts the object it is executed on into a Json string value. Always includes type names.
string.ToJsonObject<T>() converts the Json string it is executed on into an object of the desired type. Always includes type names.
object.JsonClone<T>() converts the object it is executed on into a Json string value, before converting it back to its original type and returning it. Use it to clone serializable objects without loss of data.
Don't forget to add using DuskModules.JsonNet; to any script using the module.