[Solved] Python serializate error: NameError: name ‘JSON’ is not defined

Error content:

NameError: name ‘json’ is not defined

Prompt: JSON is not defined;

JSON used in serialization:

        rep = requests.post(url, data=json.dumps(data))

Solution:

Import the JSON library, which is Python’s own library. You can import it directly

import json

Read More: