use json to serialize data structures. fixed save method