modified serialization to use json