SMAPI - Stardew Modding API

SMAPI - Stardew Modding API

971k Downloads

Add JSON converters to normalise inconsistent serialisation between platforms

Pathoschild opened this issue ยท 4 comments

commented

Some types (like Color and Point) are serialised inconsistently between Linux/Mac and Windows. This can cause errors when reading a JSON file that was generated on a different platform. Add custom JSON converters to make sure they're serialised and deserialised consistently.

commented

Vector2, FloatRect/IntRect

commented

@spacechase0 Where are FloatRect and IntRect defined?

commented

Comparison of serialised format:

type on Windows on Linux/Mac
Color "26, 51, 76, 102" { "B": 30, "G": 20, "R": 10, "A": 50 }
Point "1, 2" { "X": 1, "Y": 2 }
Rectangle "{X:1 Y:2 Width:3 Height:4}" { "X": 1, "Y": 2, "Width": 3, "Height": 4 }
Vector2 "1, 2" "1, 2"
commented

Done for Color, Point, and Rectangle in the upcoming SMAPI 2.4.