Questions tagged [jsonify]

42 questions
0
votes
1 answer

ECONNRESET Error response getting from flask python

I'm not getting the proper response for this particular API. Also , In actual implementation, I'm getting the proper 200 jsonify response when all things are running fine but if their is any exception and If I want to send back the response with 500…
Anshul Verma
  • 347
  • 1
  • 5
  • 18
0
votes
1 answer

flask.jsonify returns array with square brackets instead of curly brackets

I am using flask and jsonify for the first time and i am stuck at a small problem. My json output is returning an array format with square brackets instead of the json object with curly brackets. Can someone pls point me in the right direction? My…
user1510
  • 23
  • 3
0
votes
1 answer

Python error: Extra data: line 1 in loading a big Json file

I am trying to read a JSON file which is 370 MB import json data = open( "data.json" ,"r") json.loads(data.read()) and it's not possible to easily find the root cause of the following error, json.decoder.JSONDecodeError: Extra data: line 1 column…
mk_sch
  • 1,060
  • 4
  • 16
  • 31
0
votes
0 answers

Flask send html element as jsonify

I am trying to send a HTML element in a message of jsonify object. message = "Hello I am here click: {0}/a>".format(link) response_data = {"status": "OK", "result": message} return jsonify(response_data) But when I…
aakash singh
  • 267
  • 5
  • 19
0
votes
1 answer

Flask Ajax call getting refreshed after data received to web page

I'm doing a flask project which get a data from a form(only one input) and using ajax POST request I posted it to server and return data on same page. In return I saw that returned data were received to the web page but it get refreshed…
SjAnupa
  • 102
  • 10
0
votes
0 answers

Flask.jsonify: JSONIFY_PRETTYPRINT_REGULAR is False but the output is still pretty

I have: app.config['JSONIFY_PRETTYPRINT_REGULAR'] = False and the docs. say that even by default is False. However, my output is still pretty: { "p": { "e": { "n": { "c": "something..." } } } }
Nikk
  • 7,384
  • 8
  • 44
  • 90
-1
votes
2 answers

Return JSON array of objects in Flask

I am working on a simple CRUD application and I can't return an array of objects in Flask. My db Model is like this: class QrRecord(db.Model): id = db.Column(db.String(256), primary_key=True) name = db.Column(db.String(128), nullable=False) …
Daniel Nýdrle
  • 153
  • 1
  • 9
-1
votes
1 answer

'<' not supported between instances of 'numpy.ndarray' and 'str' while jsonify dict

I am getting below error while jsonify. TypeError: '<' not supported between instances of 'numpy.ndarray' and 'str' My code is: if rows[0]: print("row1",rows[1]) #data_json = str(rows[1]) data_json =…
-1
votes
1 answer

I don't know how to select specific items from json object in my web application using flask

response = requests.get(url) response_json = response.json() results = response_json['a'][0] output = results['a_1'] + results['a_2'] + results['a_3'] return jsonify(output) my output "abcdefg" what I want abcdefg How should I fix it?
-1
votes
1 answer

How my javascript can get json result returned by Flask Python route?

I have a flask web application with python. I have a template where user have a list of tasks with checkboxes to enable or disable the task. I use jsonify and javascript to update or disable the value in Mysql database. here is the…
Gauthier Buttez
  • 1,005
  • 1
  • 16
  • 40
-2
votes
1 answer

how to pass a json String to a url using Flask

I did create a machine learning model using Pytorch which i want to use as a webservice using Flask. The problem is that i don't understand how i can pass a json-String to the url. Below is my code that I wrote to do some tryouts with my model and…
lxg95
  • 553
  • 2
  • 8
  • 28
-2
votes
1 answer

Another "SyntaxError: 'return' outside function" for Flask Application

Im trying to get over this beginners rut and wanted to see what the community would suggest. Photo #1 CODE ON SPYDER IDE Photo #2 SyntaxError ON SPYDER CONSOLE The goal of this project is to relay the extracted data from an OBDII device to a flask…
Red Whale
  • 3
  • 4
1 2
3