Search Unity

Disable built-in Newtonsoft Json

Discussion in 'Package Manager' started by TaleOf4Gamers, Sep 19, 2021.

  1. TaleOf4Gamers

    TaleOf4Gamers

    Joined:
    Nov 15, 2013
    Posts:
    825
    Hey,

    I am trying to import a library which requires Newtonsoft Json 13 however it is clashing with the built in package and I am not sure how to either remove the built-in one or update it to the correct version. What can I do?

    Thanks!
     
  2. UnityMaru

    UnityMaru

    Community Engagement Manager PSM

    Joined:
    Mar 16, 2016
    Posts:
    1,227
    This is a known Unity scripting limitation. This is caused by Unity packages depending on the "built-in" version.

    Your best bet is to embed the "com.unity.nuget.newtonsoft-json" package into your project and you can modify it as you wish, e.g. update it to version 13 of the DLL.

    Caveat: if that newer version of the DLL is not backward-compatible, you will have to either:

    1) fix the dependency: rebuild the DLL from the Newtonsoft.Json source (it's Open Source) after fixing any issues in it to make it backward-compatible, or
    2) fix the dependent packages: embed any package that's broken by the newer DLL and fix your code to be compatible with it.
     
  3. JudahMantell

    JudahMantell

    Joined:
    Feb 28, 2017
    Posts:
    476
    @UnityMaru Hi. This is a serious issue for my project, where I rely on packages using Newtonsoft.Json version 13.0.3, while the unity one uses 13.0.2. What are my options here?
    Thank you!