Answers for "Extract JSON from http page request"

0

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);
Posted by: Guest on May-24-2021

Code answers related to "Extract JSON from http page request"

Browse Popular Code Answers by Language