Skip to content
This repository has been archived by the owner on Oct 6, 2023. It is now read-only.
Kalle Fagerberg edited this page Mar 3, 2022 · 16 revisions

Welcome to the Newtonsoft.Json-for-Unity wiki!

Logo

⚠ Deprecation warning

Since late February 2022, Unity has now published an updated version of their package: [email protected]

Their package has been a fork of my package ever since, [email protected], but it has not been intended for public use. But since now that has changed!

v3.0 of their package is still a fork of my package, but now dedicated Unity employees will maintain and support it instead of me. All future versions of their package will from now on continue branching off from my package, while my package remains marked as deprecated.

I will not add features nor publish any bug fixes. It is recommended to transition to Unity's package as soon as possible to ensure you get the latest patches.

I will not remove my package from Cloudsmith. It will remain published until the end of Cloudsmith or their free open source tier.

About this repository

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

About this wiki

This Wiki is for this repository, Newtonsoft.Json-for-Unity, and will not contain pages with how-to lists that solely aim at the official Newtonsoft.Json by JamesNK.

What you'll find here

  • ✔ Installation guide into your Unity project, via UPM, OpenUPM, UniGet, UnityPackage, and the Assets Store. Coming soontm

  • ✔ How to update the package, via UPM, UniGet, UnityPackage, and the Assets Store. Coming soontm

  • How to fix various no ahead of time (AOT) errors

  • 🕓 Guides how to serialize/deserialize Unity objects (GameObject, Vector3, Scenes, et.al) //todo

  • 🕓 Using Newtonsoft.Json in your own class library you've imported into Unity. //todo

  • 🕓 Using third party dependencies (DLLs) inside Unity that themselves use Newtonsoft.Json. //todo

What you won't find here

  • ❌ Guides and help about how to serialize/deserialize using Newtonsoft.Json
  • ❌ What's the difference between the names Newtonsoft.Json and Json.NET?
  • ❌ Game development tutorials
  • How to make a fortune with Bitcoins (₿) in 5 easy steps 🤪

To receive info about one of these topics I'm omitting from this wiki, visit one of the official Json.NET links below:

Alternative solutions

Unity has now published a maintained fork of my repo, and they will continue to maintain their own fork and keep it up-to-date. The package can be found at https://docs.unity3d.com/Packages/[email protected]/manual/index.html, and I've written some installation instructions here that you can refer to until Unity has their own installation instructions: Install official UPM package

Using 2017.* or below? Here are some alternative projects that may suffice for your Unity project:

But why another solution

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!

Alternative, non-Newtonsoft.Json solutions

I (jilleJr) will wear this project with pride, but not enough to ignore the other amazing works done by others.

While my repo will live for some time, for future reference here are some good alternatives (that all work in Unity) that I personally recommend if my solution dips below your expectations:

Of course I want my project to get better, so please create a GitHub issue on jilleJr/Newtonsoft.Json-for-Unity when you have some troubles or want a new feature.

Happy Json parsing!

Clone this wiki locally