Java 访问_“嵌入式”;spring数据REST接口中的数据

Java 访问_“嵌入式”;spring数据REST接口中的数据,java,json,spring,d3.js,Java,Json,Spring,D3.js,该项目是对业务数据的可视化分析,MongoDB通过Spring数据、REST接口,然后是d3.js 在数据库级别,我的数据如下所示: /* 1 */ { "_id" : ObjectId("58ac466160fb39e5e8dc8b70"), "dots" : { "x" : 4, "y" : 3 } } /* 2 */ { "_id" : ObjectId("58ac468060fb39e5e8dc8b7e"), "s

该项目是对业务数据的可视化分析,MongoDB通过Spring数据、REST接口,然后是d3.js

在数据库级别,我的数据如下所示:

/* 1 */
{
    "_id" : ObjectId("58ac466160fb39e5e8dc8b70"),
    "dots" : {
        "x" : 4,
        "y" : 3
    }
}

/* 2 */
{
    "_id" : ObjectId("58ac468060fb39e5e8dc8b7e"),
    "squares" : {
        "x" : 12,
        "y" : 2
    }
}
REST接口(spring)提供以下功能:

{
  "_embedded" : {
    "JSON" : [ {
      "squares" : null,
      "dots" : {
        "dot" : {
          "x" : 4,
          "y" : 3
        }
      },
      "_links" : {
        "self" : {
          "href" : "http://localhost:8080/JSON/58ac466160fb39e5e8dc8b70"
        },
        "jSON" : {
          "href" : "http://localhost:8080/JSON/58ac466160fb39e5e8dc8b70"
        }
      }
    }, {
      "squares" : {
        "square" : {
          "x" : 12,
          "y" : 2
        }
      },
      "dots" : null,
      "_links" : {
        "self" : {
          "href" : "http://localhost:8080/JSON/58ac468060fb39e5e8dc8b7e"
        },
        "jSON" : {
          "href" : "http://localhost:8080/JSON/58ac468060fb39e5e8dc8b7e"
        }
      }
    } ]
  },
  "_links" : {
    "self" : {
      "href" : "http://localhost:8080/JSON"
    },
    "profile" : {
      "href" : "http://localhost:8080/profile/JSON"
    }
  },
  "page" : {
    "size" : 20,
    "totalElements" : 2,
    "totalPages" : 1,
    "number" : 0
  }
}   
现在我很难在d3.js中访问这些数据进行可视化处理,无论我以何种方式访问数据,我只会在控制台上得到“未定义”的数据,没有返回值

我是否应该重新格式化以摆脱“_嵌入”部分,或者总体上“展平”数据,或者我是否需要一种特定的方式来访问它


到目前为止,我只是使用“d3.json(“/json”)”来访问接口,但无法提取任何数据。

如果我在jQuery AJAX中请求相同的存储库,我会得到三个对象的响应,其中包含嵌套的数据。如果我在jQuery AJAX中请求相同的存储库,我会得到三个对象的响应,其中包含嵌套的数据。不能让它与d3.js一起工作,有什么想法吗?