class Index { int status; List body; Index({this.status, this.body}); Index.fromJson(Map json) { status = json['status']; if (json['body'] != null) { body = new List(); json['body'].forEach((v) { body.add(new Body.fromJson(v)); }); } } Map toJson() { final Map data = new Map(); data['status'] = this.status; if (this.body != null) { data['body'] = this.body.map((v) => v.toJson()).toList(); } return data; } } class Body { int id; String text; Body({this.id, this.text}); Body.fromJson(Map json) { id = json['id']; text = json['text']; } Map toJson() { final Map data = new Map(); data['id'] = this.id; data['text'] = this.text; return data; } }