Use real JSON serialization.

Among other things, this allows the use of nested custom properties.