All Downloads are FREE. Search and download functionalities are using the official Maven repository.

com.aventstack.extentreports.convert.JsonDeserializer Maven / Gradle / Ivy

There is a newer version: 5.1.1
Show newest version
package com.aventstack.extentreports.convert;

import java.io.File;
import java.io.IOException;
import java.lang.reflect.Type;
import java.nio.file.Files;
import java.util.ArrayList;
import java.util.List;

import com.aventstack.extentreports.model.Test;
import com.google.gson.Gson;
import com.google.gson.reflect.TypeToken;

class JsonDeserializer {

	public static List deserialize(File f) throws IOException {
		Gson gson = new Gson();
		String json = new String(Files.readAllBytes(f.toPath()));
		Type t = new TypeToken>() {}.getType();
		List tests = gson.fromJson(json, t);
		return tests;
	}

}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy