Json.NET is a popular high-performance JSON framework for .NET
This repo is a fork of Newtonsoft.Json containing custom builds for regular standalone, but more importantly AOT targets such as all IL2CPP builds (WebGL, iOS, Android, Windows, Mac OS X) and portable .NET (UWP, WP8).
Available for installation with
- Unity Package Manager (UPM)
new!
Unity Asset packages(coming soon)Unity Asset Store(coming soon)
Requires Unity Editor
2018.1
or above, as UPM was first shipped with2018.1
.
Open <project>/Packages/manifest.json
, add scope for jillejr
, then add the package in the list of dependencies.
À la:
{
"scopedRegistries": [
{
"name": "Packages from jillejr",
"url": "https://registry.npmjs.org/",
"scopes": ["jillejr"]
}
],
"dependencies": {
"jillejr.newtonsoft.json-for-unity": "12.0.1",
"com.unity.modules.ai": "1.0.0",
"com.unity.modules.animation": "1.0.0",
"com.unity.modules.assetbundle": "1.0.0",
"com.unity.modules.audio": "1.0.0",
"com.unity.modules.cloth": "1.0.0",
"com.unity.modules.director": "1.0.0",
"com.unity.modules.imageconversion": "1.0.0"
}
}
Open the Package Manager UI Window > Package Manager
Followed by pressing the update button on the jillejr.newtonsoft.json-for-unity
package
(This is an alternative for updating. Following the guide above will suffice if your Package Manager is functional)
Change the version field. You have to know the new version beforehand.
Example, with this as old:
{ "dependencies": { "jillejr.newtonsoft.json-for-unity": "12.0.1" } }New, updated:
{ "dependencies": { "jillejr.newtonsoft.json-for-unity": "12.0.3" } }Omitted
scopedRegistries
and Unity packages for readability
Using 2017.*
or below? Here are some alternative projects that may suffice for your Unity project:
-
Newtonsoft Json.NET for Unity3D by SaladLab
github.com/SaladLab/Json.Net.Unity3D -
JSON .NET for Unity by ParentElement
parentelement.com/assets/json_net_unity
assetstore.unity.com/packages/tools/input-management/json-net-for-unity
SaladLab and ParentElement, among other unmentioned coders, have done great work in making Json.NET work in Unity. So why do we need mine?
Both mentioned projects are discontinued, and outdated by some margin in result. SaladLab's latest release targets Json.NET 9, and ParentElement's Json.NET 8. We're at Json.NET 12 now! (at time of writing)
Changeset, compared to SaladLabs and ParentElements solutions:
- Json.NET version 12 (let's see how long I can keep up with James repo)
- Release available via Unity Package Manager
- Unit testing in Unity Editor
- Unit testing in IL2CPP built platforms (ex: StandaloneWindows)
A rework is in this case easier than jumping into SaladLabs project to update it. Sorry Salad champ.
Although, in the future this may also be old stuff too, with the upcoming new System.Text.Json namespace and need to keep the project up-to-date with Newtonsoft.Json. But not for now!
This package is licensed under The MIT License (MIT)
Copyright (c) 2019 Kalle Jillheden (jilleJr)
https://github.com/jilleJr/Newtonsoft.Json
See full copyrights in LICENSE.md inside repository