class RequestEnvironment { int activityId; int cropId; String executeDate; String description; List envDetail; RequestEnvironment( {this.activityId, this.cropId, this.executeDate, this.description, this.envDetail}); RequestEnvironment.fromJson(Map json) { activityId = json['activityId']; cropId = json['cropId']; executeDate = json['executeDate']; description = json['description']; if (json['envDetail'] != null) { envDetail = new List(); json['envDetail'].forEach((v) { envDetail.add(new EnvDetail.fromJson(v)); }); } } Map toJson() { final Map data = new Map(); data['activityId'] = this.activityId; data['cropId'] = this.cropId; data['executeDate'] = this.executeDate; data['description'] = this.description; if (this.envDetail != null) { data['envDetail'] = this.envDetail.map((v) => v.toJson()).toList(); } return data; } } class EnvDetail { String name; String index; EnvDetail({this.name, this.index}); EnvDetail.fromJson(Map json) { name = json['name']; index = json['index']; } Map toJson() { final Map data = new Map(); data['name'] = this.name; data['index'] = this.index; return data; } }