关于java 接口返回的json数据问题
2022-11-04 11:07:54.181 INFO 1156 — [nio-8089-exec-1] com.comleader.service.NebulaService :
正常查询N跳关系返回的正常数据
GO 1 STEPS FROM '001.wx.qq.91933b.com' OVER * BIDIRECT \
YIELD DISTINCT tags($^) as fidtag,$^ AS fid, \
edge as e,tags($$) as tidtag,$$ AS tid | limit 100
控制台返回数据
Json返回数据
1、meta那2个jsonArray[NULL]代表什么,这里面可以理解 meta下标1为源顶点,2为边,4为目标顶点, 0 和 3 两个空的JSONARRAY不知道是什么?
[
{
"meta":[
[
null
],
{
"id":"001.wx.qq.91933b.com",
"type":"vertex"
},
{
"id":{
"dst":"103.82.143.97",
"src":"001.wx.qq.91933b.com",
"name":"url_ip",
"ranking":0,
"type":17
},
"type":"edge"
},
[
null
],
{
"id":"103.82.143.97",
"type":"vertex"
}
],
2、边 下标 0为原定点的tags,1 为源顶点的属性,2为边属性,3为目标点的tags,4为目标点的属性,不知道理解又没错。
"row":[
[
"url"
],
{
"url.tag":"3",
"url.photo_name":"",
"url.photo_path":""
},
{
},
[
"ip"
],
{
}
]
},
{
"meta":[
[
null
],
{
"id":"001.wx.qq.91933b.com",
"type":"vertex"
},
{
"id":{
"dst":"韩国",
"src":"001.wx.qq.91933b.com",
"name":"url_area",
"ranking":0,
"type":19
},
"type":"edge"
},
[
null
],
{
"id":"韩国",
"type":"vertex"
}
],
"row":[
[
"url"
],
{
"url.tag":"3",
"url.photo_name":"",
"url.photo_path":""
},
{
},
[
"area"
],
{
}
]
}
下面为其他情况返回的数据 参照上例数据对比
1、当目标定点不存在点的实体时,meta里面下标4也给null,这时候你会发现下标 0为JSONARRAY ,下标3的结构变了变成JSONORJECT了。row里面后面目标顶点的tags会给个null,属性也给个null,
{
"meta":[
[
null
],
{
"id":"1040",
"type":"vertex"
},
{
"id":{
"dst":"154tt.com",
"src":"1040",
"name":"url_template",
"ranking":0,
"type":-16
},
"type":"edge"
},
null,
null
],
"row":[
[
"template"
],
{
"template.backbone_node_num":"29",
"template.all_node_num":"247",
"template.url":"hhh94.com",
"template.max_layer":"8",
"template.node_limited_node_num":"17"
},
{
},
null,
null
]
}
然后我后端加了判断又出现了一个其他的问题
row里面后面目标顶点的tags会给个变成了JSONARRAY[NULL]了,属性也给个null,
{
"meta":[
[
null
],
{
"id":"1040",
"type":"vertex"
},
{
"id":{
"dst":"154tt.com",
"src":"1040",
"name":"url_template",
"ranking":0,
"type":-16
},
"type":"edge"
},
null,
null
],
"row":[
[
"template"
],
{
"template.backbone_node_num":"29",
"template.all_node_num":"247",
"template.url":"hhh94.com",
"template.max_layer":"8",
"template.node_limited_node_num":"17"
},
{
},
[
null
],
null
]
}
相反源定点也会出现这种问题返回的JSONOBJECT和JSONARRAY格式不定
很疑惑为什么不能按照控制台返回的结构返回对应的JSON?如果可以把查询语句AS的别名返回到JSON里就更好了。
这种数据结构对后端处理很不友好。