2
我使用螺栓驱动程序(1.0.1)与python。如何将结果转换为Json,以便通过烧瓶应用程序将其返回? 这就是我需要将数据类型“neo4j.v1.types.Record”转换为“json”。Neo4j Python的螺栓驱动程序:如何将结果转换为Json?
我想这
from flask import Flask
from neo4j.v1 import GraphDatabase, basic_auth
import json
driver = GraphDatabase.driver("bolt://localhost:7687", auth=basic_auth("neo4j","neo4j"))
session = driver.session()
app = Flask(__name__)
@app.route('/hello/<prop>')
def hello_name(prop):
result = session.run("MATCH ...") #this works perfectly fine and the data is captured in result
session.close()
for record in result:
return json.loads(record)
这将引发一个错误: - 类型错误:在JSON对象必须str的,而不是“记录”