This is my json i want to extract firstname and code using beanshell script.But i'm not able to extract the values . Please help
{
"code":"HNYC",
"message":"Sucess",
"data":{
"Employeid":"TGRDH-887",
"Perosonal":{
"Details":{
"firstname":"Sam",
"id":3566,
"dob":"23/11/1990",
"Yearofjoing":"2018",
"Salary":30000,
"Address":"New Delhi",
"City":"Delhi"
}
}
}
}
Beanshell Code:
import com.eclipsesource.json.JsonObject;
String jsonString = prev.getResponseDataAsString();
JsonObject accountId = JsonObject.readFrom(jsonString);
String code = accountId.getJSONObject("code");
print("value "+code);