解析来自Neo4j REST API查询的json响应时出现问题

解析来自Neo4j REST API查询的json响应时出现问题,json,neo4j,Json,Neo4j,将包含2个属性的节点插入Neo4j数据库后,如何从RESTAPI查询响应中提取属性(“名称”和“电话”)?我查询数据库的脚本是: <script> function query_database() { var restServerURL = "http://localhost:7474/db/data"; //local copy on windows machine $.ajax({ type:"POST", url: restServerURL + "/cypher",

将包含2个属性的节点插入Neo4j数据库后,如何从RESTAPI查询响应中提取属性(“名称”和“电话”)?我查询数据库的脚本是:

<script>
function query_database()
{
var restServerURL = "http://localhost:7474/db/data"; //local copy on windows machine
$.ajax({
  type:"POST",
  url: restServerURL + "/cypher",
  accepts: "application/json",
  dataType:"json",
  data:{
         "query" : "start n  = node(*) return n",
         "params" : {}
  },
  success: function(data, xhr, textStatus){
                  //alert("query success!");
          //process query results here

         alert(JSON.stringify(data, null, 4));
  },
  error:function(jqXHR, textStatus, errorThrown){
                   alert(errorThrown);
  }
});
}//end of query database
}

非常感谢


Jeff

在您的示例中,您可以从响应数据对象中获取姓名和电话,如下所示:

var name = data.data[0][0].data.name;
var phone = data.data[0][0].data.phone;
alert("Name is " + name + "\nPhone is " + phone);

.

Brian-感谢您快速、出色的回复。很好@如果解决了你的问题,请考虑接受/接受答案(暗示你似乎是新来的)。@ Gopi -谢谢,我不知道该怎么做,你的帖子促使我找出答案。完成。
var name = data.data[0][0].data.name;
var phone = data.data[0][0].data.phone;
alert("Name is " + name + "\nPhone is " + phone);