The discard statement is used to delete a named buffer.




The discard statement will delete the named buffer and free the memory used to store its contents. The statement takes immediate effect and any attempt to reference the buffer afterwards (at least until such time as another buffer with the same name is created) will cause the USE script to log an error and fail.


var server = "https://my_json_server.com"
buffer response = http GET ${server}/generatetoken        

# Create a variable called ${secret_token} from the 'access_token'
# string in the JSON in the {response} buffer
var secret_token = $JSON{response}.[access_token]

# We no longer need the {response} buffer as the value extracted
# from it is stored in a variable
discard {response}

Last updated