[Flask] Flask with Json Format

Amit Jalota amitjalota124 at gmail.com
Wed Feb 22 21:07:49 EST 2017


Its run time data..

On 22 February 2017 at 18:23, Corey Boyle <coreybrett at gmail.com> wrote:

> Where is your data being held?
>
> On Wed, Feb 22, 2017 at 4:07 AM, Amit Jalota <amitjalota124 at gmail.com>
> wrote:
> > Hi All,
> >             Is there is any good tutorial/handson which will return the
> data
> > in Json format with examples like handlers which will fetch the real time
> > data.
> >
> > I went through mentioned below tutorial
> > https://blog.miguelgrinberg.com/post/the-flask-mega-
> tutorial-part-i-hello-world
> > and currently I hardcoded the the Json data and returned to browser
> > now I need to return some real time data from
> > microblog/virtualenv-15.1.0/app/views.py
> >
> > instead of hardcoded.
> >
> > from flask import Flask,jsonify,json
> > from app import app
> > @app.route("/getEmployeeList")
> > def getEmployeeList():
> >     try:
> >         # Initialize a employee list
> >         employeeList = []
> >         # create a instances for filling up employee list
> >         for i in range(0,2):
> >             empDict = {
> >                 'firstName': 'Roy',
> >                 'lastName': 'Augustine'}
> >         employeeList.append(empDict)
> >         # convert to json data
> >         jsonStr = json.dumps(employeeList)
> >     except Exception ,e:
> >         print str(e)
> >     return jsonify(Employees=jsonStr)
> >
> >
> >
> > and can you please help me for interface as well to lower backed layer.
> >
> > Thanks
> >
> > _______________________________________________
> > Flask mailing list
> > Flask at python.org
> > https://mail.python.org/mailman/listinfo/flask
> >
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/flask/attachments/20170223/f9366148/attachment.html>


More information about the Flask mailing list