Search Unity

  1. Unity 2020.1 has been released.
    Dismiss Notice
  2. Good news ✨ We have more Unite Now videos available for you to watch on-demand! Come check them out and ask our experts any questions!
    Dismiss Notice

JSON .NET for Unity

Discussion in 'Assets and Asset Store' started by Dustin-Horne, Sep 13, 2013.

  1. tswalk

    tswalk

    Joined:
    Jul 27, 2013
    Posts:
    1,108
    awesome.. i'll do that in a few moments! much thanks.
     
  2. Dustin-Horne

    Dustin-Horne

    Joined:
    Apr 4, 2013
    Posts:
    4,562
    FYI - I have fixed the contact form on my site. I apologize if it caused any inconvenience. I had changed the reply to address but it wasn't properly configured on the mail server so it's been reverted.
     
  3. Maisey

    Maisey

    Joined:
    Feb 17, 2014
    Posts:
    259
    Hello Dustin!

    I'm having some trouble using the JSON.NET for Unity for Windows 10. When trying to compile I get the following error (and a bunch of similar ones):

    Code (CSharp):
    1. Assets\JsonDotNet\Source\WinRT\Converters\RT_KeyValuePairConverter.cs(52,36): error CS0121: The call is ambiguous between the following methods or properties: 'Newtonsoft.Json.Utilities.TypeExtensions.GetProperty(System.Type, string)' and 'System.Reflection.TypeExtensions.GetProperty(System.Type, string)'
    The error is quite straight forward. For example inside RT_KeyValuePairConverter.cs, you make use of System.Reflection namespace, which is needed to access the class "PropertyInfo" and it also contains definition for the extension "GetProperty(..)" but your Newtonsoft.Json.Utilities also contains definition for this extension with the same signature. Therefore causing conflict.

    I don't remember having this issue before, have I screwed up somehow or can you verify that this indeed is an issue/bug?

    Thanks!
     
  4. Dustin-Horne

    Dustin-Horne

    Joined:
    Apr 4, 2013
    Posts:
    4,562
    It's not you...it's me. :). Send me an email - dustin @ parentelement.com - and I'll send you the windows 10 support version.
     
  5. Maisey

    Maisey

    Joined:
    Feb 17, 2014
    Posts:
    259
    Haha, great that you can confirm the issue! ;) I manually changed the files required (changed the extensions to be named RT_GetProperty(...) etc) so that it works for now. Do you happen to know when an updated version hits the Asset Store? :)
     
  6. Dustin-Horne

    Dustin-Horne

    Joined:
    Apr 4, 2013
    Posts:
    4,562
    Hopefully very soon. I'm still looking at a potential il2cpp bug, I have some wsa player mappings to fix, I have some preserve attributes to add for more things that are getting occasionally stripped by il2cpp, I have a link.xml file to create, and for some reason json .net is causing Unity cloud build to fail for some platforms, I think probably because of an underscore in a folder bame. Oh and I'm adding hololens and Apple TV mappings.
     
  7. Maisey

    Maisey

    Joined:
    Feb 17, 2014
    Posts:
    259
    Sounds like a lot of work, seems like you need to change "very soon" to Very Soon! ;)

    Thanks for the info!
     
  8. Dustin-Horne

    Dustin-Horne

    Joined:
    Apr 4, 2013
    Posts:
    4,562
    No problem. :)
     
  9. SidarVasco

    SidarVasco

    Joined:
    Feb 9, 2015
    Posts:
    163
    Im getting the error :
    Code (csharp):
    1. CS0021: Cannot apply indexing with [] to an expression of type `object'
    It works fine on my other computer. But when importing my code to another gives me that.

    Edit:
    I remember this happening before without changing much and I had to go back to an older working commit. Reimporting doesn't seem to work either.

    Edit2:

    There seems to be a nuance when iterating over a JArray. When using the var keyword
    Code (csharp):
    1. foreach(var item in myJArray)
    it seens to interpret the var as a JArray object, although in my working copy it works fine as JToken or JObject.

    Specifying the var as JObject fixes my problem, but it's a bit weird it has a chance of working.
     
    Last edited: Apr 18, 2016
  10. Dustin-Horne

    Dustin-Horne

    Joined:
    Apr 4, 2013
    Posts:
    4,562
    That is weird, but it's also not a JSON .NET Bug. Sounds like there might be a bug in the Mono Enumerator implementation. It is strange that it works on one machine and not another. I wonder if you have a corrupt install of something.
     
  11. SidarVasco

    SidarVasco

    Joined:
    Feb 9, 2015
    Posts:
    163
    Actually it didn't work when I imported my code into a clean project. The var was then interpreted as a JArray type. I guess the compiler sometimes is a bit drunk. Eitherway, no problem.

    On a different note.

    I have structured my data like so :

    Code (csharp):
    1.  "items":[
    2.     {
    3.         "name" : "bla",
    4.         "value" : "blavalue"
    5.     },
    6.     etc,
    7.     etc,
    8.      ....
    9. ]
    10.  
    This works fine but the downside of this is that I have to do a lookup ( where or select using linq ) if I want a specific item with a certain name. My "database" doesn't have many items so i'm not worried about performance. However this:


    Code (csharp):
    1.  "items":[
    2.     "bla" : "blavalue",
    3.     etc,
    4.     etc,
    5.      ....
    6. ]
    7.  
    Would be more accessible. Since my database editor is suppose to be generic as much as possible the key itself ( "bla" for example ) is subject to change. But I had trouble finding a simple way of changing key values. Any suggestions?
    The other downside with this structure is that it would probably be hard to add more fields if it's just a Key:Value setup.

    To avoid complex linq queries Im manually populating a class and all the properties, I've failed deserialize my data to a specific type so i ended up doing it manually. I iterate over my items and map the "name" as a key to a dictionary. But I know there should be some functionality that can do it for me ( although I have no idea if it actually makes a difference in speed and memory consumption ). Perhaps I haven't seen it but do you have an article on this?
     
  12. Dustin-Horne

    Dustin-Horne

    Joined:
    Apr 4, 2013
    Posts:
    4,562
    Well there are several ways you can handle it. "items" can be a Dictionary<string, yourtype> as long as the name used for the key is always Unique. That would make lookups much quicker. I would suggest not deserializing the whole thing every time you do a lookup though... just keep an in-memory version and serialize back to your DB whenever you need to persist changes. Then you only have to rehydrate from the DB on load.

    As to your other question... let's say you have this class:

    Code (csharp):
    1.  
    2. public class GameItem
    3. {
    4.      public string Name {get; set;}
    5.      public string Value {get; set;}
    6. }
    7.  
    Then you can have:
    Code (csharp):
    1.  
    2. public class ItemInventory
    3. {
    4.     public Dictionary<string, GameItem> Items {get; set;}
    5.  
    6.     public ItemInventory() { Items = new Dictionary<string, GameItem>(); }
    7.  
    8.     public GameItem Get(string key)
    9.     {
    10.           GameItem result = null;
    11.           Items.TryGetValue(key, out result);
    12.           return result;
    13.     }
    14.  
    15.     public void Set(GameItem item)
    16.     {
    17.          if(Items.ContainsKey(item.Name)
    18.          {
    19.                Items[item.Name] = item;
    20.           }
    21.          else
    22.          {
    23.                Items.Add(item.Name, item);
    24.          }
    25.     }
    26.  
    27. //...etc
    28.     }
    29. }
    30.  
    Now you just
    Code (csharp):
    1.  
    2. JsonConvert.SerializeObject(itemInventoryInstance);
    3.  
    and

    Code (csharp):
    1.  
    2. JsonConvert.DeserializeObject<ItemInventory>(jsonString);
    3.  
    That will also match the structure of the first piece of data you sent me. It also makes lookups much quicker because it uses a hashed base lookup for the Dictionary and it's very fast.
     
  13. SidarVasco

    SidarVasco

    Joined:
    Feb 9, 2015
    Posts:
    163
    My structure is more complex than that snippet but I think I can manage from your example. Thanks!
     
    Dustin-Horne likes this.
  14. drycactus

    drycactus

    Joined:
    Sep 8, 2015
    Posts:
    6
    Hi,
    thanks for the plugin!

    I'm seralizing Vector2 and only want x,y properties, so I'm using:
    [JsonConverter(typeof(Vector2Converter))]

    However, I now need to serialize a Vector2[], like so:
    public Vector2[] points;

    and that results in writing all the extra information I don't need (magnitude, etc).

    Searching around I only find solutions that involve using ItemConverterType, ex:
    [JsonProperty(ItemConverterType = typeof(Vector2Converter))]

    which is not present in JSON.Net, any other ideas?

    Thanks!
     
  15. Dustin-Horne

    Dustin-Horne

    Joined:
    Apr 4, 2013
    Posts:
    4,562
    Yes, ItemConverterType will be supported soon, in the meantime you need a specific converter for collections. I'm in the process of writing one for vector3 lists, I'll write one for vector2 collectiontions as well.
     
  16. Dustin-Horne

    Dustin-Horne

    Joined:
    Apr 4, 2013
    Posts:
    4,562
    I've attached the EnumerableVector3Converter. It is not yet tested, but should work with any IEnumerable<Vector3> (List, Array, etc). To use it with Vector2 you'll just need to copy it and modify it to check for IEnumerable<Vector2> and just write the x and y properties rather than x, y and z.
     

    Attached Files:

  17. hunterua

    hunterua

    Joined:
    Nov 5, 2009
    Posts:
    41
    Hi!
    I found out that as of today HashSet<int> still an issue in last version. Do you have an idea for workaround this problem on iOS ?

    Thanks !

     
  18. Dustin-Horne

    Dustin-Horne

    Joined:
    Apr 4, 2013
    Posts:
    4,562
    It is, I shifted gears a bit. JSON .NET quickly went to V7 and then to V8 so I'm working on a V8 upgrade, but there have been too many gears in motion. Supporting Windows Store (native, not IL2CPP) means needing to use an assembly that targets .NET core, which means that my update for Windows 10 (still in Beta) is precompiled. I'm working on a multi-target project (single project solution) that supports all platforms, but that requires Visual Studio 2015. This isn't an issue except that some early 5.x releases won't compile for IL2CPP my DLLs that were compiled in VS2015. Also, Unity 4.x does not support DLL mapping the way 5.x does.

    So, I'll be removing support for Unity 3.x. I'll also be dropping support for WebPlayer but I'll be adding official support for Win10 Universal, Apple TV, HoloLens, etc. Those platforms I already support in a private build. I'll have to publish multiple versions to the asset store as well (same asset version but with different Unity versions) so I can support different platform mappings. Unity 4.x will be full source code. Unity 5.x will be precompiled but will include zipped source. And I have to release multiple 5.x versions so I can support different user bases that haven't upgraded and support newer things such as HoloLens, Android IL2CPP (experimental), Apple TV, etc.

    In the mean time though, I'll take another look at HashSet from a custom converter perspective. I tried to fix it outright but the older Monoversion means that Hashset<T> is missing an Interface implementation that it has in newer .NET versions so I can't dynamically determine the difference between it and some other collection types.
     
    hunterua likes this.
  19. drycactus

    drycactus

    Joined:
    Sep 8, 2015
    Posts:
    6
    Thanks, worked like a charm!
     
    Dustin-Horne likes this.
  20. celaeno

    celaeno

    Joined:
    Jan 31, 2013
    Posts:
    54
    Hello,

    I purchased your product, I'm not familiar with json. What's the example jsontest scene supposed to do? It says
    The referenced script on this Behaviour (Game Object 'ScriptHost') is missing.

    Is this a bug, or what script should I attach to it?

    I would like to read some json date from a webserver, is there a good documentation somewhere?

    Thanks
     
  21. Dustin-Horne

    Dustin-Horne

    Joined:
    Apr 4, 2013
    Posts:
    4,562
    You'll need to attach the TextTest.cs file to the ScriptHost gameobject. This was a weird Unity bug I haven't figured out.. Since I publish from Unity 3.5, every time I export the asset to a unity package it breaks that link and disconnects that script. The test scene just does some various serialization and deserialization and outputs results to the output window and the screen. You can delete the scene if you want and just look at the scripts to see how it's working.

    The official documentation is here:
    http://www.newtonsoft.com/json/help/html/Introduction.htm

    And script samples here:
    http://www.newtonsoft.com/json/help/html/Samples.htm

    There are a few features that aren't supported in the asset yet such as ItemTypeConverter and CustomCreationConverter but I'm in the process of upgrading the port to Json .NET v8 which will add those features and fix some other various bugs such as XML to Json conversion.

    In the next major release which will be updated to v8, I'll be removing support for Unity 3.x and just concentrating on 4.6 and above. I will also be removing WebPlayer support.
     
  22. celaeno

    celaeno

    Joined:
    Jan 31, 2013
    Posts:
    54
    Thanks for your answer.

    I attached the TextTest.cs script and it's working now. But can you maybe get me a little bit on track? I'd like to import json data from http://api.football-data.org/v1/soccerseasons/

    I'm using JSON-View-Plugin for firefox to see the data. Can you maybe show some code where I have to put the url address and how to read the data or setup the variables?

    I tried to figure it out, but I'm totally new to json.

    Thanks
     
  23. Dustin-Horne

    Dustin-Horne

    Joined:
    Apr 4, 2013
    Posts:
    4,562
    So, first you would need to get that JSON back, probably using Www.text. Next you'll need a proper object to hold the stuff. That is an array of objects, each one having the following properties:

    _links (an object)
    id (integer)
    caption (string)
    league (string)
    year (string but you could use integer)
    currentMatchday (integer)
    numberOfMatchdays (integer)
    numberOfTeams (integer)
    numberOfGames (integer)
    lastUpdated (DateTime)

    The _links object has the following properties:
    self (Object)
    teams (Object)
    fixtures (Object)
    leagueTable (Object)

    Now, self, teams, fixtures and leageTable all have the same structure... an object with an href property that's a string. We'll start with that because it's the innermost object... it can be a struct to avoid uneccesary allocations.

    Code (csharp):
    1.  
    2. public struct LinkItem() {
    3.      public string href {get; set;}
    4. }
    5.  
    Now, you can create your Link object

    Code (csharp):
    1.  
    2. public struct Links
    3. {
    4.      public LinkItem self {get; set;}
    5.      public LinkItem teams{get; set;}
    6.      public LinkItem fixtures {get; set;}
    7.      public LinkItem leagueTable {get; set;}
    8. }
    9.  
    Now we can think about your Seasons object... the first thing I'd like to address is the "_links" property. I'd like to create that without the _ in front of it, so I'll use the JsonProperty attribute. It will look like this:

    Code (csharp):
    1.  
    2. public class Season
    3. {
    4.      [JsonProperty(propertyName="_links")]
    5.      public Links links {get; set;}
    6.  
    7.      public int id {get; set;}
    8.      public string caption {get; set;}
    9.      public string league {get; set;}
    10.      public int year {get; set;}
    11.      public int currentMatchday {get; set;}
    12.      public int numberOfMatchdays {get; set;}
    13.      public int numberOfTeams {get; set;}
    14.      public int numberOfGames {get; set;}
    15. }
    16.  
    Now assuming you got your jsonString variable from the server, you can deserialize like this:

    Code (csharp):
    1.  
    2.     var seasons = JsonConvert.DeserializeObject<Season[]>(jsonString);
    3.  
    The above uses an array, but you could use List<Season> as well. I prefer uppercase property names, since you're only deserializing, you could use upper case property names for your properties and it would work fine without being case sensitive. You could also use Struct for your Season as well but it's starting to get pretty big. If you're only using it in a single method or caching it somewhere that would be fine but if you're passing it around between methods you'd have to think about what you want to do. If you need to use it by reference you'll want it to be a class (same with its properties). If you're passing it around, the size of that struct will be bigger than an integer pointer so you'll just have to balance performance between heap allocations and passing large data. It just depends on your scenario.

    You can also use http://www.json2csharp.com, but beware that it may generate uneccesary code. It's a great tool to start with but if you put your Json in it, you'll see that rather than a single LinkItem class, it created a new class for each property, so you still have to do some hand tweaking.
     
  24. celaeno

    celaeno

    Joined:
    Jan 31, 2013
    Posts:
    54
    Oke thank you very much for your detailed explanation :). I'm going to check it out.
     
  25. Ben-BearFish

    Ben-BearFish

    Joined:
    Sep 6, 2011
    Posts:
    1,197
    Is there a way with the Deserialization settings to tell the exception not be thrown when the Deserialization fails due to a null exception? I've tried every setting and it still throws the Exception. I'd like the Deserialization to fail and return null if this is possible.
     
  26. Dustin-Horne

    Dustin-Horne

    Joined:
    Apr 4, 2013
    Posts:
    4,562
    What null reference exception? You mean the string you're passing in is null? You could wrap your deserialization in a try/catch and catch the exception, then default to null.
     
  27. Ben-BearFish

    Ben-BearFish

    Joined:
    Sep 6, 2011
    Posts:
    1,197
    Yeah, that's what I meant. Looks like that did the trick. Thanks, I didn't realize the solution was so simple.
     
    Dustin-Horne likes this.
  28. Metastable

    Metastable

    Joined:
    Apr 10, 2013
    Posts:
    44
    @Dustin Horne I know your working hard to get the next version out but was just wondering if you had an ETA or perhaps I could get an advanced copy? I'm working on a project that would really make my life easier if I had access to JContainer.Merge and that's implemented in Json.Net 6+.
     
  29. castor76

    castor76

    Joined:
    Dec 5, 2011
    Posts:
    1,794
    Hi. Just bought and tested the asset on XboxOne but I get some JIT error for some of the tests. I have sent log file to the email address included in the asset but just asking here to see if you can respond.

    also sending to the dustin @ parentelement.com as well.
     
  30. Dustin-Horne

    Dustin-Horne

    Joined:
    Apr 4, 2013
    Posts:
    4,562
    I don't have a stable enough version to send out yet but I'm cranking on it as quickly as I can. There were major architectural changes in JSON .NET since I ported over the last copy. My asset right now also uses three different versions of JSON .NET (if you count the UWP RC) and I'm consolidating into a single version and working to make it easier to update in the future. I'm also working on building in more default converters to better support serialization of Unity objects like Vectors, Color, etc.

    Got it, replied and I'm putting together those custom converters for you to get around the Unity bug. Did you get that bug report submitted? Could I get the bug number if you did? This bug has been around for over a year so I'd like to get Unity to address it since it only affects Unity built in Structs and only on Xbox One. :/
     
  31. Metastable

    Metastable

    Joined:
    Apr 10, 2013
    Posts:
    44
    Sounds like a large undertaking. I'll go ahead and implement what I need with what I have then and switch over once you are done. Thanks for the hard work!
     
  32. Dustin-Horne

    Dustin-Horne

    Joined:
    Apr 4, 2013
    Posts:
    4,562
    Depending on your needs, I do have a working Standalone version. It's version 8.0.4 of Json .NET. I actually may have WSA (Windows Universal) finished up today as well. What platforms are you targeting?

    Edit: Standalone meaning Editor, Linux, Standalone PC and Mac.
     
  33. Dustin-Horne

    Dustin-Horne

    Joined:
    Apr 4, 2013
    Posts:
    4,562
    Standalone, Editor and Windows 10 Universal are all upgraded to Json .NET 8.0.4 and working. I've got a weird "Exited with code 1" error on Windows 8.1 Universal and Windows / Windows Phone 8.1. I'm going to bypass those platforms for the time being and keep working on IL2CPP / AOT support. I think we're getting pretty close to a beta state for the update.
     
  34. Dustin-Horne

    Dustin-Horne

    Joined:
    Apr 4, 2013
    Posts:
    4,562
    Windows 8.1, Windows Phone 8.1 and Windows Universal 8.1 are now ported and working as well. The remaining ports are:

    AOT (This will cover IOS, PS3, PS4, Xbox 360, Xbox One, WiiU, Apple TV, Tizen and all IL2CPP builds) and Android. The AOT upgraded build may work with Android which would be ideal, but I may have to tweak a special build because Assembly resolution varies slightly.
     
    Tinjaw likes this.
  35. Dustin-Horne

    Dustin-Horne

    Joined:
    Apr 4, 2013
    Posts:
    4,562
    Final update for the evening and great news! I am successfully building and running on Windows 10 Universal with IL2CPP backend. The initial test is a very basic piece of serialization and deserialization. I need to write some more comprehensive tests, but theoretically it should now work with the other platforms as well.

    What's left:

    Test remaining AOT / IL2CPP Platforms - I will definitely need some beta testers for these.
    Re-implement Unity specific converters
    Finialize Testing
    Go Live!

    What's Changed:
    I've been a bit quiet on the upgrade because a few things threw me for a loop during the process, and my original plan for multi-targeting got scratched when Microsoft decided they are going to phase out the project.json format, so I essentially started from scratch but this is a good thing! I originally had started with JSON .NET 7.x but now I'm on the latest and greatest 8.0.4.

    For Unity 5.x, the asset will be shipped as a series of DLLs. It will be a single asset package with a much simplified folder structure that will contain pre-compiled assemblies for various platforms. These will be pre-mapped to the proper platforms, with the exception of Xbox 360 / One. PS3 / 4 and WiiU which I cannot map without access to those SDKs, but it's a single DLL for all of those platforms and simple to map. I will include detailed instructions. If I can manually edit the settings file to map them, I will.

    Source code will be provided in an included zip file. This will be a single visual studio solution with a few projects. These projects share (most of) the same files so a change in one project will be reflected in all others, no more doubling up on files.

    All platforms will be on the same JSON .NET version! This new version supports multi-threaded serialization and deserialization (except on WebGL where threading is not yet supported). It also supports ItemConverterType so JsonConverters can be shared between objects and collections.

    I haven't done any benchmarking, but JSON .NET has had some significant performance improvements. Additionally, it has been streamlined to reduce allocations. This is a good thing for everyone.

    I have not yet figured out how I can support Unity 4.x without hacking things together. I need to guestimate how many users I have on Unity 4.x and see if I want to continue supporting it. If the need is big enough I'll have to splice together a Unity 4.x version, but support for Unity 4.x will be limited.

    WebPlayer support will be removed. Going forward I will no longer be supporting WebPlayer, but WebGL will be supported.

    I have been adding Preserve attributes to common internal JsonDotNet classes. This will help minimize the issues my current release occasionally has with stripping when used with the IL2CPP backend.

    More converters! I'll be included custom converters for Vector2, 3, 4, Matrix4x4, Resolution, Color and more. I want to better support built in Unity types. Additionally, these converters will be standard in the DLL and will be enabled automatically. This means less noise in your JSON (no more auto-generated properties being serialized), and it also means no more hacking around Unity's Xbox One bugs that they haven't fixed and don't appear interested in fixing when deserializing built in structs.

    That's all I can thing of for now... I'm sure there's more but my brain is fried and I'm going to go spend some time with my wife. But, I'm super excited about the progress and the release is within grasp. This will be a big win for everyone.
     
    Player7 and Tinjaw like this.
  36. Tinjaw

    Tinjaw

    Joined:
    Jan 9, 2014
    Posts:
    518
    That's all excellent news Dustin. Thanks for your hard work and dedication with the asset.
     
    Dustin-Horne likes this.
  37. hunterua

    hunterua

    Joined:
    Nov 5, 2009
    Posts:
    41
    Thank you for your efforts !

     
    Dustin-Horne likes this.
  38. Metastable

    Metastable

    Joined:
    Apr 10, 2013
    Posts:
    44
    For the moment I'm only interested in standalone, mobile some time later, but it sounds like you're almost ready for a release! I think I can hold out for a bit or I can even test the project if you'd like. I'm mostly interested in the merge capability that was added in the 6.0 version.
     
  39. Dustin-Horne

    Dustin-Horne

    Joined:
    Apr 4, 2013
    Posts:
    4,562
    Sounds great! Let me go ahead and get the I initial converters put in so it will work with Vectors, etc. Can you shoot me an email? dustin(@)parentelement.com without the parens of course. :). I'll have a test build ready tonight or tomorrow morning.
     
  40. Metastable

    Metastable

    Joined:
    Apr 10, 2013
    Posts:
    44
    Sent! Thanks again.
     
  41. Dustin-Horne

    Dustin-Horne

    Joined:
    Apr 4, 2013
    Posts:
    4,562
    Alright, I sent over the Alpha build. The package size is pretty large (about 2.5 MB) because I included the xml doc files and debug symbols as well.
     
  42. Dustin-Horne

    Dustin-Horne

    Joined:
    Apr 4, 2013
    Posts:
    4,562
    UPDATE: Windows 10 Universal builds with a more comprehensive test suite are working perfectly with IL2CPP backend. With .NET Backend there is currently a bug with Polymorphic serialization that's attempting to deserialize a property twice, I'm looking into that.

    WebGL / IOS IL2CPP builds are building fine but some things are being stripped (default constructor for TypeConverter currently). TypeConverter is a built in type so I cannot add a preserve attribute to it but I am also working on a links.xml file to include which will prevent stripping of essential built in types.

    If all goes well I will have the IL2CPP platforms ready for heavier testing today.
     
  43. Player7

    Player7

    Joined:
    Oct 21, 2015
    Posts:
    1,535
    What is the current json.net version using?
     
  44. Dustin-Horne

    Dustin-Horne

    Joined:
    Apr 4, 2013
    Posts:
    4,562
    Depends on the platform. Most platforms (standalone, any IL2CPP / AOT) are using 4.3 because that's what I originally ported. However, I have taken newer bug fixes and put them in as well. The WinRT version is Json .NET 5r08. And the Win10 (currently unpublished) is using 7.

    This has been a headache for me as I've had to shim in new versions to support new platforms. The new version I'm working on is a complete start to finish report. It's a much cleaner port and puts all platforms on Json .NET version 8.0.4.
     
    RD likes this.
  45. Player7

    Player7

    Joined:
    Oct 21, 2015
    Posts:
    1,535
    That's going to be a nice leap then
     
  46. Dustin-Horne

    Dustin-Horne

    Joined:
    Apr 4, 2013
    Posts:
    4,562
    Yep, more stable, bug fixes, more features, better performance and less allocations.
     
  47. Dustin-Horne

    Dustin-Horne

    Joined:
    Apr 4, 2013
    Posts:
    4,562
    Latest update is now working with WebGL - no more errors resulting from stripping. Just a few more things to tidy up:

    1. Need to remove a few more types that Unity doesn't have access to (System.Data for example) and the code around them. No errors are thrown due to these, but there's no need to include them.

    2. Need to fix the duplicate property issue in UWP.

    3. Need to run full suite of tests against all platforms.

    As of now it looks like it is working and should fully support all platforms except WebPlayer.
     
    Tinjaw likes this.
  48. Grinch_GEO

    Grinch_GEO

    Joined:
    Apr 19, 2014
    Posts:
    90
    Hello @Dustin Horne
    have this error when building UWP 10

    Assets\JsonDotNet\Source\WinRT\Serialization\RT_JsonTypeReflector.cs(170,43): error CS0121: The call is ambiguous between the following methods or properties: 'System.Reflection.TypeExtensions.GetInterfaces(System.Type)' and 'Newtonsoft.Json.Utilities.TypeExtensions.GetInterfaces(System.Type)'

    can you help me ?
     
  49. Dustin-Horne

    Dustin-Horne

    Joined:
    Apr 4, 2013
    Posts:
    4,562
    Sure, send me an email to dustin (at) parentelement.com with your invoice number and I'll send you an update. Windows 10 support isn't in the asset store yet. I have a package to send you which adds it to the current version and I'm nearing release of a full blown update which will support it as well.
     
  50. Grinch_GEO

    Grinch_GEO

    Joined:
    Apr 19, 2014
    Posts:
    90
    check mail :)
     
unityunity