Questions tagged [jsonify]

42 questions
0
votes
1 answer

Django 'jsonify' is not a registered tag library. Must be one of:

I am working on a django project where Installed a package called jsonify which is to be used in the django template from https://pypi.org/project/jsonify/ & added in the installed apps: INSTALLED_APPS = [ "django.contrib.admin", …
0
votes
1 answer

How to return a json response in one line in flask?

I am coding a route in flask to send this response and I need to send this json response in a single solid line but when I send this json(because of length) send in multiple line @app.route("/dashboard", methods= ['GET','POST']) def…
MADPED
  • 23
  • 7
0
votes
1 answer

request.get_json() is always NoneType

I just created a basic test application with flask: from flask import Flask, jsonify, request app = Flask(__name__) @app.route("/test", methods=["POST", "GET"]) def test(): data = request.get_json() return str(type(data)) if __name__ ==…
lxg95
  • 553
  • 2
  • 8
  • 28
0
votes
1 answer

Flask: jsonify listed generator

I'm using flask to jsonify a generator that has been listed using the list() command inside a dictionary like so: r = { "stocks": list(current_user.stocks) } But when I try to use jsonify(r) I get the following error: TypeError: Object…
lipebromf
  • 1
  • 2
0
votes
0 answers

Flask rest api using python produces blank screen when accessed through angular httpClient

I am trying to build a basic rest api that returns json in flask(python) and trying to host it on heroku so that I can access the api from angular httpClient. Here's the heroku api https://testmyak.herokuapp.com/projects The problem is that on…
0
votes
1 answer

Return url for an image with jsonify

I want to return the URL for an image as JSON with jsonify. Everything is ok, but when I access the URL, error 404. This is my code: from flask import Flask, jsonify import json app = Flask(__name__) with open("config.json") as f: data =…
0
votes
0 answers

Attribute error when trying to use jsonify to return json

I'm relatively new to python and I'm trying to get to grips with jsonify within flask. I've looked at some basic online examples and tried to replicate:- @app.route('/json') def getjson(): info = { 'yes':'success', 'at last':'it…
0
votes
2 answers

Python Flask Type Error when returning SQLAlchemy query result

I run a query to populate a on a web form. The is working. I click submit, which should POST the selection back to Flask, which runs a query on it. I am getting TypeError: Object of type BaseQuery is not JSON serializable. This part seems to work…
0
votes
1 answer

Method Not Allowed The method is not allowed for the requested URL

I am trying to return a list of the random numbers after click but having an error saying " Method Not Allowed The method is not allowed for the requested URL." I am really new to the flask. following is the code: main.py import flask …
prachi
  • 11
  • 2
0
votes
1 answer

Flask jsonify returns bytes and string instead of json object

In Postman post_new_cafe prints json as it suppose to be, but when I want to print it inside console and webpage it prints differently. See example below. @app.route('/add_form', methods=['GET', 'POST']) def add_new_cafe_form(): form =…
0
votes
1 answer

I don't know how to select specific items from jsonnified 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 I'm creating a web app using…
0
votes
1 answer

How to get correct result when you pass in route. Flask, Python, FlaskForm

Good Evening. Hope you doing great. I need to get correct result when I pass in route.. Later I will be connecting 2 dropdowns (1st - countries and 2nd - files for specific country) in my flask app, but before that I need to accomplish this…
Yara1994
  • 317
  • 2
  • 11
0
votes
0 answers

Having trouble with jsonify in Flask

I am fairly new to Flask and am currently working on a project whose goal is to transcribe mp3 files into JSON. I decided to attempt to use Flask, but it's been more challenging than I thought. As of right now, I am able to display a example JSON…
pebato
  • 1
0
votes
0 answers

Flask - TypeError: Object of type cycle is not JSON serializable

I'm trying to return a json response from server to client after client makes a post via AJAX. Like this, it works: @app.route("/test", methods=["GET", "POST"]) @login_required def test(): if request.is_xhr: try: json_response = { …
rjunior8
  • 23
  • 6
0
votes
1 answer

Why is flask jsonify returning unidentified?

I am using fetch on the frontend to send data to my flask backend in order to make a movie seat booking. The whole process works fine until the client awaits the response, which is "undefined" . So , basically the database saves the data , the only…
outlier11
  • 11
  • 2