Search
 
SCRIPT & CODE EXAMPLE
 

JAVASCRIPT

json to flutter model

class certification_model {
  String? responseCode;
  String? responseMessage;
  String? companyName;
  String? companyAddress;
  String? companyNTN;
  String? customerName;
  String? issuanceDate;
  String? nICNO;
  String? totalTaxAmount;
  String? totalTaxAmountWords;
  String? dateFrom;
  String? dateTo;
  String? account;
  String? totalTaxableAmount;
  String? section;
  List<CertificateDetails>? certificateDetails;

  certification_model(
      {this.responseCode,
      this.responseMessage,
      this.companyName,
      this.companyAddress,
      this.companyNTN,
      this.customerName,
      this.issuanceDate,
      this.nICNO,
      this.totalTaxAmount,
      this.totalTaxAmountWords,
      this.dateFrom,
      this.dateTo,
      this.account,
      this.totalTaxableAmount,
      this.section,
      this.certificateDetails});

  certification_model.fromJson(Map<String, dynamic> json) {
    responseCode = json['ResponseCode'];
    responseMessage = json['ResponseMessage'];
    companyName = json['CompanyName'];
    companyAddress = json['CompanyAddress'];
    companyNTN = json['CompanyNTN'];
    customerName = json['CustomerName'];
    issuanceDate = json['IssuanceDate'];
    nICNO = json['NIC_NO'];
    totalTaxAmount = json['TotalTaxAmount'];
    totalTaxAmountWords = json['TotalTaxAmountWords'];
    dateFrom = json['DateFrom'];
    dateTo = json['DateTo'];
    account = json['Account'];
    totalTaxableAmount = json['TotalTaxableAmount'];
    section = json['Section'];
    if (json['CertificateDetails'] != null) {
      certificateDetails = <CertificateDetails>[];
      json['CertificateDetails'].forEach((v) {
        certificateDetails!.add(new CertificateDetails.fromJson(v));
      });
    }
  }

  Map<String, dynamic> toJson() {
    final Map<String, dynamic> data = new Map<String, dynamic>();
    data['ResponseCode'] = this.responseCode;
    data['ResponseMessage'] = this.responseMessage;
    data['CompanyName'] = this.companyName;
    data['CompanyAddress'] = this.companyAddress;
    data['CompanyNTN'] = this.companyNTN;
    data['CustomerName'] = this.customerName;
    data['IssuanceDate'] = this.issuanceDate;
    data['NIC_NO'] = this.nICNO;
    data['TotalTaxAmount'] = this.totalTaxAmount;
    data['TotalTaxAmountWords'] = this.totalTaxAmountWords;
    data['DateFrom'] = this.dateFrom;
    data['DateTo'] = this.dateTo;
    data['Account'] = this.account;
    data['TotalTaxableAmount'] = this.totalTaxableAmount;
    data['Section'] = this.section;
    if (this.certificateDetails != null) {
      data['CertificateDetails'] =
          this.certificateDetails!.map((v) => v.toJson()).toList();
    }
    return data;
  }
}

class CertificateDetails {
  String? cPR;
  String? amount;

  CertificateDetails({this.cPR, this.amount});

  CertificateDetails.fromJson(Map<String, dynamic> json) {
    cPR = json['CPR'];
    amount = json['Amount'];
  }

  Map<String, dynamic> toJson() {
    final Map<String, dynamic> data = new Map<String, dynamic>();
    data['CPR'] = this.cPR;
    data['Amount'] = this.amount;
    return data;
  }
}
Comment

PREVIOUS NEXT
Code Example
Javascript :: js csv to json 
Javascript :: remove all search engines chrome 
Javascript :: Image resize using html and javascript 
Javascript :: get number right of the dot length javascript 
Javascript :: js immediately invoked function 
Javascript :: Progress bar loader angular 
Javascript :: Get the values from the "GET" parameters 
Javascript :: javascript try...catch...finally 
Javascript :: hashnode 
Javascript :: html call javascript function with input value 
Javascript :: desestructuración javascript 
Javascript :: update reducer 
Javascript :: create random password 
Javascript :: how to change image on mouse click in javascript 
Javascript :: javascript github 
Javascript :: Authentication handling in javascript 
Javascript :: angular how to use service in class 
Javascript :: max value in an array 
Javascript :: form changes button enable reactive forms 
Javascript :: validatorjs number 
Javascript :: frames[i] js 
Javascript :: js value to boolean 
Javascript :: how to identify index of nested arrays in javascriptn 
Javascript :: javascript get all instances of a class 
Javascript :: module 
Javascript :: node.js vm 
Javascript :: object initializer in javascript 
Javascript :: how to stop angular server 
Javascript :: dom js 
Javascript :: React closing a dropdown when click outside 
ADD CONTENT
Topic
Content
Source link
Name
1+2 =