Will JSON be able to serialize private fields?

I read over the Google doc but I didn’t seem to get if it matters whether the field is public or private. What are the rules with this? Is it the same with how it is in Unity right now? (i.e. private fields are not serialized, unless you use the [SerializeField] attribute).

I’m asking since I usually prefer hiding my variables as private/protected for encapsulation, but still want some of them serialized.

It serializes the exact same fields the normal Unity serialization system serializes. So yes, it will serialize private fields if you mark them with [SerializeField] attribute.

5 Likes