toJson method

String toJson()

Implementation

String toJson() {
  String resultImages = "";
  for (ImageResult image in images) {
    resultImages += "${image.toJson()},";
  }
  if (resultImages.isNotEmpty) {
    resultImages = resultImages.substring(0, resultImages.length - 1);
  }
  String resultInfos = "";
  for (ErrorMsg info in sessionInfos){
    resultInfos += "${info.toJson()},";
  }
  if(resultInfos.isNotEmpty){
    resultInfos = resultInfos.substring(0, resultInfos.length - 1);
  }
  String? cisQuality;
  if(cisImageQualityStatus != null) {
    cisQuality = "\"${cisImageQualityStatus!.name()}\"";
  } else {
    cisQuality = null;
  }
  return "{\"images\":[$resultImages]," "\"document\":{${document?.toJson() ?? ""}},\"onlineContext\":${onlineContext?.toJson() ?? ""}"
      ", \"sessionInfos\":[$resultInfos], \"cisImageQualityStatus\":$cisQuality}";
}