Extract JSON from http page request code example
Example: Extract JSON from http page request
//get the previous http response and eval it
var resp_ = context.variableManager.getValue("EntryResponse");
if (resp_ == null) {
context.fail("Variable 'EntryResponse' not found");
}
logger.debug("EntryResponse="+resp_);
var resp = eval("("+resp_+")")
//then used resp as real json
logger.debug("Logged User Id="+resp.data.id);
// Inject a value in a runtime variable
context.variableManager.setValue("UserName", resp.data.id);