MagicJinn
MagicJinn
Explore posts from servers
CC#
Created by MagicJinn on 10/21/2024 in #help
Force Newtonsoft to deserialize into certain formats
Well perhaps Dictionary<string,object> is just the default for JsonFx, as JObject is for Newtonsoft
36 replies
CC#
Created by MagicJinn on 10/21/2024 in #help
Force Newtonsoft to deserialize into certain formats
The type specified. So new JsonReader.Read<Dictionary<string,object>> will have JsonFx attempt to deserialize every object into another Dictionary<string,object>.
36 replies
CC#
Created by MagicJinn on 10/21/2024 in #help
Force Newtonsoft to deserialize into certain formats
If I'm not wrong, when you deserialize with JsonFx, all nested objects will also deserialize into that type, and arrays will deserialize into lists of that type
36 replies
CC#
Created by MagicJinn on 10/21/2024 in #help
Force Newtonsoft to deserialize into certain formats
When you specify Dictionary<string,object>, it'll convert nested objects to JObjects (or List<JObject>), that I know for sure. When I try to patch the existing methods in the game to deserialize into custom classes, I get non-descript errors, but I'm assuming that's what is happening as well. I can't be certain though, and I'd have to do more testing. I've temporarily given up on it though, since for some reason, when using Newtonsoft, seemingly unrelated methods fail spectacularly at random intervals.
36 replies
CC#
Created by MagicJinn on 10/21/2024 in #help
Force Newtonsoft to deserialize into certain formats
Yes.
36 replies
CC#
Created by MagicJinn on 10/21/2024 in #help
Force Newtonsoft to deserialize into certain formats
I'll test it tho, unless anyone has a better idea.
36 replies
CC#
Created by MagicJinn on 10/21/2024 in #help
Force Newtonsoft to deserialize into certain formats
I guess I could recursively cast into the desired type, but I'm not sure what the performance cost of that will be.
36 replies
CC#
Created by MagicJinn on 10/21/2024 in #help
Force Newtonsoft to deserialize into certain formats
The game I'm modding sadly relies on JsonFx's behaviour.
36 replies
CC#
Created by MagicJinn on 10/21/2024 in #help
Force Newtonsoft to deserialize into certain formats
Well here's the deal, I can adjust my code to work with newtonsoft types, but I can't adjust the code of the game I'm modding, or at least I can't majorly overhaul it.
36 replies
CC#
Created by MagicJinn on 10/21/2024 in #help
Force Newtonsoft to deserialize into certain formats
Nope. Net3.5, Unity 2018.
36 replies
CC#
Created by MagicJinn on 10/21/2024 in #help
Force Newtonsoft to deserialize into certain formats
Because it's generic object and doesn't carry a type in JSON
Well JsonFx and Newtonsoft have different behaviour in this case. JsonFx deserializes nested objects into T or List<T>, and Newtonsoft into JObject and List<JObject>. I'm not entirely sure how the wiki page you sent helps me with that.
36 replies
CC#
Created by MagicJinn on 10/21/2024 in #help
Force Newtonsoft to deserialize into certain formats
For performance reasons. I've tried my very, VERY best to use Swifter.Json, which doesn't have this problem and is faster, but it doesn't work at all. I'm modding a game that has a massive bottleneck in loading times because of JsonFx.
36 replies
CC#
Created by MagicJinn on 10/21/2024 in #help
Force Newtonsoft to deserialize into certain formats
I mention T and List<T> because I plan to use this code with code other people wrote, and I don't want to refactor giant swaths of code just so it can handle JObjects.
36 replies
CC#
Created by MagicJinn on 10/15/2024 in #help
Utf8Json or Jil for Net3.5
This is a new one:
An exception was thrown by the type initializer for SDLS.JSON
[Info : Console] Stack trace: at SDLS.Plugin.TrashAllJSON () [0x00000] in <filename unknown>:0
at SDLS.Plugin.Initialization () [0x00000] in <filename unknown>:0
An exception was thrown by the type initializer for SDLS.JSON
[Info : Console] Stack trace: at SDLS.Plugin.TrashAllJSON () [0x00000] in <filename unknown>:0
at SDLS.Plugin.Initialization () [0x00000] in <filename unknown>:0
37 replies
CC#
Created by MagicJinn on 10/15/2024 in #help
Utf8Json or Jil for Net3.5
Something seems to be very wrong.
37 replies
CC#
Created by MagicJinn on 10/15/2024 in #help
Utf8Json or Jil for Net3.5
[Info : Console] Error occurred while processing JSON for 'events': Could not load file or assembly 'System.Runtime.Serialization, Version=3.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089' or one of its dependencies.
With Newtonsoft :)
37 replies
CC#
Created by MagicJinn on 10/15/2024 in #help
Utf8Json or Jil for Net3.5
True. I think I can iron out the kinks when I get it running though. Problem is that I haven't gotten this stuff to run a single time. Although it might not look like it from this thread, I'm pretty decent at coding, and when I encounter a problem, I'm persistent in solving it. The problem here is that this is a problem that I've never heard of and doesn't really make sense, and seemingly nobody else has had this problem either.
37 replies
CC#
Created by MagicJinn on 10/15/2024 in #help
Utf8Json or Jil for Net3.5
The code is pretty locked down. Only way I can hope to improve performance is to use a different deserializer.
37 replies
CC#
Created by MagicJinn on 10/15/2024 in #help
Utf8Json or Jil for Net3.5
The developers over at Failbetter games are not known for being good at coding. JsonFx is quite slow, but that only compounds the effect of their lack of optimisation. They've been using the same system for ages... And the tech debt is really weighing the system down. Deserializing into List<Failbetter.Core.Event>> takes 8 seconds, List<Dictionary<string,object>> takes 2.
37 replies