added serialization/deserialization hook for using JSON