Add toJson/fromJson methods