The Photon Forum
is Closed Permanently.

After many dedicated years of service, we have made the decision to retire our Forum and switch to read-only: we´ve saved the best to last! Your search result can be found below. Plus, we offer support via these channels:

Try Our
Documentation

Please check if you can find an answer in our extensive documentation on PUN.

Join Us
on Discord

Meet and talk to our staff and the entire Photon-Community via Discord.

Read More on
Stack Overflow

Find more information on Stack Overflow (for Circle members only).

Write Us
an E-Mail

Feel free to send your question directly to our developers.

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

d0raem0n231
2019-04-26 13:37:45

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
2019-04-26 13:45:49

Ok.. I deleted 'Newtonsoft.Json.dll' from photon folder.
Console cleared, but I wonder that this file isn't needed.

JohnTube
2019-04-26 13:58:46

Hi @d0raem0n231,

Thank you for choosing Photon!

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

from

Dictionary values = JsonConvert.DeserializeObject>(result);

to

Optionally remove:

using Newtonsoft.Json;

d0raem0n231
2019-04-28 14:28:34

Dictionary<string, string> values = JsonConvert.DeserializeObject<Dictionary<string, string>>(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 wrote:

Hi @d0raem0n231,

Thank you for choosing Photon!

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

from

Dictionary values = JsonConvert.DeserializeObject>(result);

to

Optionally remove:

using Newtonsoft.Json;

JohnTube
2019-04-29 09:31:17

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
2019-05-06 10:47:39

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.

Back to top