converter json em dardo
class NewsDescriptionModel {
NewsDetail? newsDetail;
String? editorList;
List<Tags>? tags;
NewsDescriptionModel({this.newsDetail, this.editorList, this.tags});
NewsDescriptionModel.fromJson(Map<String, dynamic> json) {
newsDetail = json['NewsDetail'] != null
? new NewsDetail.fromJson(json['NewsDetail'])
: null;
editorList = json['editorList'];
if (json['tags'] != null) {
tags = <Tags>[];
json['tags'].forEach((v) {
tags!.add(new Tags.fromJson(v));
});
}
}
Map<String, dynamic> toJson() {
final Map<String, dynamic> data = new Map<String, dynamic>();
if (this.newsDetail != null) {
data['NewsDetail'] = this.newsDetail!.toJson();
}
data['editorList'] = this.editorList;
if (this.tags != null) {
data['tags'] = this.tags!.map((v) => v.toJson()).toList();
}
return data;
}
}
class NewsDetail {
String? id;
String? source;
String? author;
String? title;
String? timestamp;
String? section;
String? slug;
String? sectionId;
String? content;
String? websiteurl;
String? thumbnailUrl;
String? sectionUrl;
String? url;
String? newsType;
String? highlights;
String? comments;
NewsDetail(
{this.id,
this.source,
this.author,
this.title,
this.timestamp,
this.section,
this.slug,
this.sectionId,
this.content,
this.websiteurl,
this.thumbnailUrl,
this.sectionUrl,
this.url,
this.newsType,
this.highlights,
this.comments});
NewsDetail.fromJson(Map<String, dynamic> json) {
id = json['id'];
source = json['source'];
author = json['author'];
title = json['title'];
timestamp = json['timestamp'];
section = json['section'];
slug = json['slug'];
sectionId = json['section_id'];
content = json['content'];
websiteurl = json['websiteurl'];
thumbnailUrl = json['thumbnail_url'];
sectionUrl = json['section_url'];
url = json['url'];
newsType = json['news_type'];
highlights = json['highlights'];
comments = json['comments'];
}
Map<String, dynamic> toJson() {
final Map<String, dynamic> data = new Map<String, dynamic>();
data['id'] = this.id;
data['source'] = this.source;
data['author'] = this.author;
data['title'] = this.title;
data['timestamp'] = this.timestamp;
data['section'] = this.section;
data['slug'] = this.slug;
data['section_id'] = this.sectionId;
data['content'] = this.content;
data['websiteurl'] = this.websiteurl;
data['thumbnail_url'] = this.thumbnailUrl;
data['section_url'] = this.sectionUrl;
data['url'] = this.url;
data['news_type'] = this.newsType;
data['highlights'] = this.highlights;
data['comments'] = this.comments;
return data;
}
}
class Tags {
String? title;
int? topicID;
String? sectionPageURL;
Tags({this.title, this.topicID, this.sectionPageURL});
Tags.fromJson(Map<String, dynamic> json) {
title = json['title'];
topicID = json['topicID'];
sectionPageURL = json['sectionPageURL'];
}
Map<String, dynamic> toJson() {
final Map<String, dynamic> data = new Map<String, dynamic>();
data['title'] = this.title;
data['topicID'] = this.topicID;
data['sectionPageURL'] = this.sectionPageURL;
return data;
}
}
Priyanka Bhosale