code: def to_json(df, x, y):
          
          values = []
          for i, row in df.iterrows():
              values.append({
                  "x": row[x],
                  "y": row[y]
                  })
  
          if df.empty:
              return {"result": [{"x": 0, "y": 0}], "date": False}
  
          return {"result": values, "date": False}
docs: Format output for json response.