I want to create a json payload like
{
"email":"dautpure@gmail.com",
"validators": ["SyntaxValidator", "MXValidator", "ListDetectiveValidator"]
}
I wrote the following code :
package com.forcelocker.loaddata;
import com.google.gson.JsonObject;
import com.mashape.unirest.http.HttpResponse;
import com.mashape.unirest.http.Unirest;
import com.mashape.unirest.http.exceptions.UnirestException;
import java.lang.reflect.Array;
import java.util.ArrayList;
public class validateEmail
{
public static String CheckingURL = "h_ttps://abc.com/address/v1/validateEmail";
private static final String Content_Type ="application/json";
public static Boolean CheckEmail(String Email,String Token) throws UnirestException
{
Boolean IsmailOk=false;
String Authorization = "Bearer "+Token;
JsonObject payload = new JsonObject();
payload.addProperty("email", Email);
HttpResponse<String> response = Unirest.post(CheckingURL)
.header("Content-Type", Content_Type)
.header("Authorization", Authorization)
.body(payload).asString();
return IsmailOk;
}
}
But I don't know how to put the validator in JSON which can hold a comma seperate values
any help would be great.