I want to use the payload of a post request in another function . I tried everything in this post to read the payload of the post request.
I get this error
raise JSONDecodeError("Expecting value", s, err.value)
json.decoder.JSONDecodeError: Expecting value: line 1 column 1 (char 0)
My code:
@app.route('/resource', methods = ['POST'])
def do_something():
data = str(request.get_data().decode('utf-8'))
print(data)
# output --> firstName=Sara&lastName=Laine
res = json.dumps(data)
another_function(res)
return jsonify(data)