Added to_json method for serialization