Skip to content

Instantly share code, notes, and snippets.

@mittsh
Last active August 29, 2015 14:21
Show Gist options
  • Save mittsh/c8790ebb0ee36d7ccdb0 to your computer and use it in GitHub Desktop.
Save mittsh/c8790ebb0ee36d7ccdb0 to your computer and use it in GitHub Desktop.
Get a response value and increment
function evaluate(context){
// get response body
var responseBody = context.getCurrentRequest().getLastExchange().responseBody;
// parse JSON
var jsonDict = JSON.parse(responseBody);
// access the value we need
var value = jsonDict.id; // e.g. access the "id" field
// parse int and increment
return parseInt(value) + 1;
};
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment