Skip to content

Commit

Permalink
fix: json serialization loop (#175)
Browse files Browse the repository at this point in the history
  • Loading branch information
poi-vrc authored Aug 27, 2023
1 parent b46191c commit fc2d61c
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,13 @@ public override object ReadJson(JsonReader reader, Type objectType, object exist

public override void WriteJson(JsonWriter writer, object value, JsonSerializer serializer)
{
serializer.Serialize(writer, value);
var module = (CabinetModule)value;
var jObject = new JObject
{
{ "moduleName", module.moduleName },
{ "config", JObject.FromObject(module.config) }
};
jObject.WriteTo(writer);
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,13 @@ public override object ReadJson(JsonReader reader, Type objectType, object exist

public override void WriteJson(JsonWriter writer, object value, JsonSerializer serializer)
{
serializer.Serialize(writer, value);
var module = (WearableModule)value;
var jObject = new JObject
{
{ "moduleName", module.moduleName },
{ "config", JObject.FromObject(module.config) }
};
jObject.WriteTo(writer);
}
}

Expand Down

0 comments on commit fc2d61c

Please sign in to comment.