You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Hi! I hope I'm posting this in the right place...
I am currently having a teeny problem with deserializing some JSON in my project. Originally, my project was using JSON .NET for Unity plugin by ParentElement, and so I have a lot of files which contain JSON that was created using their serializer. They were created with the following settings: var settings = new JsonSerializerSettings() { PreserveReferencesHandling = PreserveReferencesHandling.Objects };
The object I serialized contained UnityEngine.Color and the resulting JSON contained $id metadata for the Colors. However, when I used your serializer with the converter and the same ReferenceHandling settings, $id tags are not generated for the Colors.
The problem I am having is when I try to deserialize the existing JSON in my project, I get the following error:
Newtonsoft.Json.JsonSerializationException : Unexpected token while deserializing object: PropertyName. Path 'Path.To.Property.After.Color'
If it helps, here is the class containing the Color:
[JsonObject(MemberSerialization = MemberSerialization.Fields)]
public class Style
{
...
private Color32 color;
public Color Color { get; set; }
...
}
I was wondering you might know what's going wrong and of any way of dealing with this issue. Thanks in advance.
The text was updated successfully, but these errors were encountered:
My custom converts does not support the different JsonSerializerSettings as I've intentionally not considered them. The UnityEngine.Color and UnityEngine.Color32 types are structs, and so there should be no use for having $id references between them.
I'll try to reproduce this and take a closer look, because you should not get an error like that either case.
Hi! I hope I'm posting this in the right place...
I am currently having a teeny problem with deserializing some JSON in my project. Originally, my project was using JSON .NET for Unity plugin by ParentElement, and so I have a lot of files which contain JSON that was created using their serializer. They were created with the following settings:
var settings = new JsonSerializerSettings() { PreserveReferencesHandling = PreserveReferencesHandling.Objects };
The object I serialized contained
UnityEngine.Color
and the resulting JSON contained$id
metadata for the Colors. However, when I used your serializer with the converter and the same ReferenceHandling settings,$id
tags are not generated for the Colors.The problem I am having is when I try to deserialize the existing JSON in my project, I get the following error:
If it helps, here is the class containing the Color:
I was wondering you might know what's going wrong and of any way of dealing with this issue. Thanks in advance.
The text was updated successfully, but these errors were encountered: