How to Create JSON Using Python Flask


try:

   # Code will be here

except Exception ,e:
    print str(e)

return "Employee"
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)