The type 'JsonConvert' exists in both 'Newtonsoft.Json

Options
I use Youtube API made from LightShaft
There is another 'JsonConver.dll'

Assets\Photon\PhotonUnityNetworking\Code\Editor\AccountService.cs(203,49): error CS0433: The type 'JsonConvert' exists in both 'Newtonsoft.Json, Version=8.0.0.0, Culture=neutral, PublicKeyToken=null' and 'Newtonsoft.Json, Version=4.5.0.0, Culture=neutral, PublicKeyToken=30ad4fe6b2a6aeed'

How can I get out of this issue?
I am waiting for your advice.

Comments

  • d0raem0n231
    edited April 2019
    Options
    Ok.. I deleted 'Newtonsoft.Json.dll' from photon folder.
    Console cleared, but I wonder that this file isn't needed.
  • JohnTube
    JohnTube ✭✭✭✭✭
    edited April 2019
    Options
    Hi @d0raem0n231,

    Thank you for choosing Photon!

    In "Assets\Photon\PhotonUnityNetworking\Code\Editor\AccountService.cs", replace line 203:

    from
    Dictionary<string, string> values = JsonConvert.DeserializeObject<Dictionary<string, string>>(result);
    to
    Dictionary<string, string> values = Newtonsoft.Json.JsonConvert.DeserializeObject<Dictionary<string, string>>(result);
    Optionally remove:

    using Newtonsoft.Json;
  • d0raem0n231
    Options
    Dictionary values = JsonConvert.DeserializeObject>(result);

    Thank you..
    But I can not solve that problem.
    Red underline don't disappear..

    Is there method to select version of Newtonsoft.Json.JsonConvert?


    JohnTube said:

    Hi @d0raem0n231,

    Thank you for choosing Photon!

    In "Assets\Photon\PhotonUnityNetworking\Code\Editor\AccountService.cs", replace line 203:

    from

    Dictionary<string, string> values = JsonConvert.DeserializeObject<Dictionary<string, string>>(result);
    to
    Dictionary<string, string> values = Newtonsoft.Json.JsonConvert.DeserializeObject<Dictionary<string, string>>(result);
    Optionally remove:

    using Newtonsoft.Json;
  • JohnTube
    JohnTube ✭✭✭✭✭
    Options
    Hi @d0raem0n231,

    I see now.
    it was a misunderstanding from my part, I overlooked some details.

    So the issue is that you ended up with two versions of Newtonsoft DLLs and no that a class with the same name "JsonConvert" exists in two different namespaces.

    You can remove one of the two DLLs I guess the oldest.

    In the future, we will get rid of Newtonsoft from PUN to avoid this.
  • JohnTube
    JohnTube ✭✭✭✭✭
    Options
    FYI:
    Since PUN2.11.
    We have removed Newtonsoft DLL from PUN2 as it's no longer dependent from it since we replaced it by Unity's built-in JsonUtility.