Search Unity

  1. Welcome to the Unity Forums! Please take the time to read our Code of Conduct to familiarize yourself with the forum rules and how to post constructively.
  2. Dismiss Notice

PlatformNotSupportedException with Json.NET (newtonsoft)

Discussion in 'Editor & General Support' started by vladblatpy, Aug 12, 2019.

  1. vladblatpy

    vladblatpy

    Joined:
    Jul 23, 2019
    Posts:
    4
    Hello
    I use JSON serialization by JsonConvert.SerializeObject of Json.NET
    And it works in Unity editor game emulation, but didn't work on build not for Windows 10, not for Ubuntu 18.04
    In log i see:
    PlatformNotSupportedException: Operation is not supported on this platform....

    What should i do to pass this problem?
     
    Morgun71 and SamFernGamer4k like this.
  2. vladblatpy

    vladblatpy

    Joined:
    Jul 23, 2019
    Posts:
    4
    SOLUTION:
    edit->project settings->player->other settings->API compability level: from .NET 2.0 to .NET 4.x
     
  3. Pixsaoul

    Pixsaoul

    Joined:
    Feb 10, 2014
    Posts:
    14
    Is there anything like json.net that would be compatible with net standard 2.0 ? Thanks it solved the issue for me btw ;)
     
    RiverExplorer and SamFernGamer4k like this.
  4. ismaelnascimentoash

    ismaelnascimentoash

    Joined:
    Apr 2, 2017
    Posts:
    30
    Thank you!
     
    SamFernGamer4k likes this.
  5. Lionel362

    Lionel362

    Joined:
    Feb 25, 2016
    Posts:
    1
    God bless you
     
  6. alkannyunus

    alkannyunus

    Joined:
    Jul 6, 2020
    Posts:
    19
    Not work in Unity 2021.2.6f1
     
    RiverExplorer and theolagendijk like this.
  7. theolagendijk

    theolagendijk

    Joined:
    Nov 12, 2014
    Posts:
    117
    And the same goes for Unity 2021.2.7f1 building for MacOS standalone with .Net Framework (4.x) results in ;

    PlatformNotSupportedException: Operation is not supported on this platform.

    (referring to NewtonSoft's use of System.Reflection.Emit.DynamicMethod..ctor)
     
  8. theolagendijk

    theolagendijk

    Joined:
    Nov 12, 2014
    Posts:
    117
  9. theolagendijk

    theolagendijk

    Joined:
    Nov 12, 2014
    Posts:
    117
    alkannyunus likes this.
  10. alkannyunus

    alkannyunus

    Joined:
    Jul 6, 2020
    Posts:
    19
    Emanx140 and theolagendijk like this.