Toward the end of this documentation there is an example of reading context using json.load().
json.load() takes a file handle, but your example just provides the string.
import os
import json
# Load context as json
context = json.load(os.path.join(os.environ['INPUT_DIR'], "context.json"))
users = context['nested']['data']['users']
userOneEmail = users[0]['email'] # peter@losant.com
Should be something like
import os
import json
# Load context as json
with open(os.path.join(os.environ['INPUT_DIR'], "context.json"), 'r') as f:
context = json.load(f)
users = context['nested']['data']['users']
userOneEmail = users[0]['email'] # peter@losant.com