JSON PARA DART
class CoursesModel {
List<Data>? data;
CoursesModel({this.data});
CoursesModel.fromJson(Map<String, dynamic> json) {
if (json['data'] != null) {
data = <Data>[];
json['data'].forEach((v) {
data!.add(new Data.fromJson(v));
});
}
}
Map<String, dynamic> toJson() {
final Map<String, dynamic> data = new Map<String, dynamic>();
if (this.data != null) {
data['data'] = this.data!.map((v) => v.toJson()).toList();
}
return data;
}
}
class Data {
int? id;
String? status;
String? createdOn;
String? title;
Thumbnail? thumbnail;
String? summery;
String? slug;
Category? category;
String? link;
String? coupon;
Data(
{this.id,
this.status,
this.createdOn,
this.title,
this.thumbnail,
this.summery,
this.slug,
this.category,
this.link,
this.coupon});
Data.fromJson(Map<String, dynamic> json) {
id = json['id'];
status = json['status'];
createdOn = json['created_on'];
title = json['title'];
thumbnail = json['thumbnail'] != null
? new Thumbnail.fromJson(json['thumbnail'])
: null;
summery = json['summery'];
slug = json['slug'];
category = json['category'] != null
? new Category.fromJson(json['category'])
: null;
link = json['link'];
coupon = json['coupon'];
}
Map<String, dynamic> toJson() {
final Map<String, dynamic> data = new Map<String, dynamic>();
data['id'] = this.id;
data['status'] = this.status;
data['created_on'] = this.createdOn;
data['title'] = this.title;
if (this.thumbnail != null) {
data['thumbnail'] = this.thumbnail!.toJson();
}
data['summery'] = this.summery;
data['slug'] = this.slug;
if (this.category != null) {
data['category'] = this.category!.toJson();
}
data['link'] = this.link;
data['coupon'] = this.coupon;
return data;
}
}
class Thumbnail {
Data? data;
Thumbnail({this.data});
Thumbnail.fromJson(Map<String, dynamic> json) {
data = json['data'] != null ? new Data.fromJson(json['data']) : null;
}
Map<String, dynamic> toJson() {
final Map<String, dynamic> data = new Map<String, dynamic>();
if (this.data != null) {
data['data'] = this.data!.toJson();
}
return data;
}
}
class Data {
String? fullUrl;
String? url;
String? assetUrl;
List<Thumbnails>? thumbnails;
Null? embed;
Data({this.fullUrl, this.url, this.assetUrl, this.thumbnails, this.embed});
Data.fromJson(Map<String, dynamic> json) {
fullUrl = json['full_url'];
url = json['url'];
assetUrl = json['asset_url'];
if (json['thumbnails'] != null) {
thumbnails = <Thumbnails>[];
json['thumbnails'].forEach((v) {
thumbnails!.add(new Thumbnails.fromJson(v));
});
}
embed = json['embed'];
}
Map<String, dynamic> toJson() {
final Map<String, dynamic> data = new Map<String, dynamic>();
data['full_url'] = this.fullUrl;
data['url'] = this.url;
data['asset_url'] = this.assetUrl;
if (this.thumbnails != null) {
data['thumbnails'] = this.thumbnails!.map((v) => v.toJson()).toList();
}
data['embed'] = this.embed;
return data;
}
}
class Thumbnails {
String? key;
String? url;
String? relativeUrl;
String? dimension;
int? width;
int? height;
Thumbnails(
{this.key,
this.url,
this.relativeUrl,
this.dimension,
this.width,
this.height});
Thumbnails.fromJson(Map<String, dynamic> json) {
key = json['key'];
url = json['url'];
relativeUrl = json['relative_url'];
dimension = json['dimension'];
width = json['width'];
height = json['height'];
}
Map<String, dynamic> toJson() {
final Map<String, dynamic> data = new Map<String, dynamic>();
data['key'] = this.key;
data['url'] = this.url;
data['relative_url'] = this.relativeUrl;
data['dimension'] = this.dimension;
data['width'] = this.width;
data['height'] = this.height;
return data;
}
}
class Category {
int? id;
Category({this.id});
Category.fromJson(Map<String, dynamic> json) {
id = json['id'];
}
Map<String, dynamic> toJson() {
final Map<String, dynamic> data = new Map<String, dynamic>();
data['id'] = this.id;
return data;
}
}
Handsome Heron