Questions tagged [jsonify]

42 questions
6
votes
1 answer

Flask Countdown Timer

I am building a game using Flask where every round has a countdown time to complete the round. I want the time value to decrease by 1 every second and to update without reloading the page. The countdown itself uses a time.sleep to wait 1 second…
rmd_po
  • 381
  • 1
  • 4
  • 12
2
votes
2 answers

ERROR: TypeError: Object of type ColumnClause is not JSON serializable Python3

Hi i'm getting this error. TypeError: Object of type ColumnClause is not JSON serializable. Whole thing: [2020-10-26 22:17:58,448] ERROR in app: Exception on /all-user [GET] Traceback (most recent call last): File…
RyanTheRyan
  • 83
  • 11
2
votes
1 answer

Jsonify does not pretty print on Heroku

I am building a simple flask app, jsonify() works fine on my localhost, it will return the information with new lines and the proper indent in a json format. However, when running the exact same code on Heroku, it omits the new lines and the…
ItzSylex
  • 23
  • 3
2
votes
0 answers

Python datetime UTC timezone is ruined with flask jsonify

When UTC becomes GMT-0, it seems like flask jsonify doesn't adjust. Example: server and database is in New york which is currently UTC-4. When datetime has "2020-06-29 2:20:55-04" or "datetime.datetime(2020, 6, 28, 10, 20, 55, 613105,…
Mav S.
  • 21
  • 5
1
vote
2 answers

How to directly use Flask's jsonify with custom classes like FireO Models?

I'm using Flask version 2.3.2 and FireO ORM 2.1.0 FireO models are not directly compatible with Flask's jsonify. Meaning that they are not serializables by default and need to be converted into a dictionary before passing them to…
Caponte
  • 401
  • 1
  • 11
  • 20
1
vote
3 answers

Flask jsonify returns Response. How to provide status code?

I sow a lot of examples where developers have the following expression: return jsonify(data), 200 Even in my last work project I had the same expression, but now, when I'm trying to write my new project, I catch the following error: TypeError:…
1
vote
0 answers

Random (incorrect) comma appears in JSON with very large request from Flask

Im trying to send a json from Flask to NodeJS and respond a pdf. The json contains data necessary for making receipts used by the walking collector and its basic structure looks like…
Nirox
  • 13
  • 2
1
vote
1 answer

Error when returning flash.jsonify() in Flask App

Background:I'm building a basic flask app, that will allow me to return a Collection from a Atlas Compass Cluster and then use the Collection data to create an HTML container to display the data and create some D3 charts. Issue:I've created two…
William
  • 191
  • 5
  • 32
1
vote
1 answer

Flask_restx @api.route return statement results in a TypeError

I have a problem I am not able to solve. I want to make use of http cookies in flask. This is the code from documentation: @app.route('/token/auth', methods=['POST']) def login(): username = request.json.get('username', None) password =…
Data Mastery
  • 1,555
  • 4
  • 18
  • 60
0
votes
1 answer

Python Jsonify returns text/html

I have a python application which returns a bunch of league fixtures: class Fixture: def __init__(self, matchday, date, home_team, away_team, predicted_winner, spread): self.matchday = matchday self.date = date …
0
votes
0 answers

get output in json format

from flask import Flask,jsonify from flask_sqlalchemy import SQLAlchemy import os import jsonpickle app = Flask(__name__) # the name of the database; add path if necessary db_name = 'student.db' app.config['SQLALCHEMY_DATABASE_URI'] =…
Randi
  • 61
  • 7
0
votes
1 answer

Python format date in jsonfiy output

How to intercept datetime value and make custom format? Here is how i fetch records and put them in json format: cursor.execute(sql) row_headers = [x[0] for x in cursor.description] json_data = [] for row in cursor.fetchall(): …
Josef
  • 2,648
  • 5
  • 37
  • 73
0
votes
1 answer

Return jsonify not back to the render template page

I want to do data preprocessing for machine learning app in flask. the flow is, the html form send form to javascript code and then to the flask route. this i my html form
0
votes
0 answers

Flask / jsonify with nested lists / dictionary

I'm writing a name matching api for a client and I'm using flask's jsonify functionality for the first time. Here's what I need to do: A user enters a company name(s) into the front end interface calling the api which then performs a search based on…
B. Youngman
  • 123
  • 1
  • 12
0
votes
1 answer

Jsonify dictionary in python in flask

I am new to python, I am upgrading a flask app from python2 to python3 with minimal code changes, but not able to get rid of issue with dictionary and jsonify. Here 'data' is a dictionary. message = { 'success': True, …
tony
  • 71
  • 2
1
2 3