Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR JAVASCRIPT

json to dart

class Faclity {
  String? responseCode;
  String? responseMessage;
  List<Facilities>? facilities;

  Faclity({this.responseCode, this.responseMessage, this.facilities});

  Faclity.fromJson(Map<String, dynamic> json) {
    responseCode = json['ResponseCode'];
    responseMessage = json['ResponseMessage'];
    if (json['facilities'] != null) {
      facilities = <Facilities>[];
      json['facilities'].forEach((v) {
        facilities!.add(new Facilities.fromJson(v));
      });
    }
  }

  Map<String, dynamic> toJson() {
    final Map<String, dynamic> data = new Map<String, dynamic>();
    data['ResponseCode'] = this.responseCode;
    data['ResponseMessage'] = this.responseMessage;
    if (this.facilities != null) {
      data['facilities'] = this.facilities!.map((v) => v.toJson()).toList();
    }
    return data;
  }
}

class Facilities {
  String? faclityCode;
  String? faclityDescription;

  Facilities({this.faclityCode, this.faclityDescription});

  Facilities.fromJson(Map<String, dynamic> json) {
    faclityCode = json['FaclityCode'];
    faclityDescription = json['FaclityDescription'];
  }

  Map<String, dynamic> toJson() {
    final Map<String, dynamic> data = new Map<String, dynamic>();
    data['FaclityCode'] = this.faclityCode;
    data['FaclityDescription'] = this.faclityDescription;
    return data;
  }
}
Source by javiercbk.github.io #
 
PREVIOUS NEXT
Tagged: #json #dart
ADD COMMENT
Topic
Name
9+7 =