BernEugen / Newtonsoft.Json-for-Unity

Newtonsoft.Json (Json.NET) 12.0.1 for Unity via Unity Package Manager

Home Page:https://www.npmjs.com/package/jillejr.newtonsoft.json-for-unity

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Logo Newtonsoft.Json for Unity

npm

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)

Installation via UPM

Requires Unity Editor 2018.1 or above, as UPM was first shipped with 2018.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"
  }
}

Updating the package

Updating via the UI

Open the Package Manager UI Window > Package Manager

preview of where window button is

Followed by pressing the update button on the jillejr.newtonsoft.json-for-unity package

preview of update button

Updating manually via the manifest file

(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

Official Json.NET links

Alternative solutions

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!


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

About

Newtonsoft.Json (Json.NET) 12.0.1 for Unity via Unity Package Manager

https://www.npmjs.com/package/jillejr.newtonsoft.json-for-unity

License:MIT License


Languages

Language:C# 99.9%Language:PowerShell 0.1%