0

I have a JSON response that's having NULL for most of the key-value pairs within the JSON message.

Python interpretor is not liking it:

NameError: global name 'null' is not defined

Function below:

def api_notification_invoke(notid):
data =      {
              "status": null,
              "message": null,
              "errors": null,
              "method": "POST"
                }

        js = json.dumps(data, indent=4)

        resp = Response(js, status=200, mimetype='application/json')
        return resp
user2545476
  • 31
  • 1
  • 4

1 Answers1

6

Change all nulls to None. In Python the 'null' object is the singleton None

Marlon Abeykoon
  • 11,927
  • 4
  • 54
  • 75