Invalid code for reading context example

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

@Scott_Matton,

Welcome to the Losant Forums, we’re very happy you’re here!

Thank you for pointing this out. We’ll confirm this on our side and then get this fixed in our documentation.

Let us know if there is anything else we can help you with.

Thank you,
Heath