Since when did JSONEncode() nullify certain datatypes?

Okay, so I’ve been working on a DataStore module today, and I came across a bug that I just couldn’t solve–data was being encoded, saved, loaded, and then decoded with no error, except that all values would return null. I eventually narrowed it down to JSONEncode(), and made an example script that demonstrates my issue perfectly:


As you can see, the Color3, UDim2, and Vector3 values are all nullified in the encoding process. Why? I’m almost certain this didn’t happen before, and it certainly isn’t desired behavior, but I’m not officially classifying this as a bug because I may be missing something.

Any clarification on this is appreciated, thanks.

JSON only supports basic data types (number, string, boolean). If roblox were to make it support special types then it would not be JSON.


Well, that’s irritating. Thanks for the quick answer, though.

You can write your own serializer for the incompatible types.

That’s true. I adapted my code to save the position as multiple numbers instead.

1 Like

Yes, I too am lazy enough to make a new serializer as opposed to a quick workaround. You should be able to use one of those versions if you’re needing to save data types. Old code though, no guarantees.


is it a module? i am not quite sure how to implement or use it

though i know it’s use, i just cant find a way to implement these types of scripts