Ruby on Rails JSON is able to parse out curl calls in the following format:
name=test
. It will interpret this as {"name": "test"}
.
Python's JSON
seems to take this as a JSON error (which it obviously is). Is there a way however, to take parse payload in the format of name=test
? I'm using Python's JSON
with Flask here.
If you are using flask, why not use jsonify
from flask import jsonify
@app.route('/do')
def do_whatever():
return jsonify(name=test)
This will send a JSON response like this to the browser:
{
"name": "test",
}
Try
fields = curl_str.split('=')
curl_json = { fields[0]:fields[1] }
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.