我目前正在尝试构建用户的层次结构视图。我的最终目标是使用这个层次视图 或类似的东西生成视图。
难点在于如何给出用于生成层次结构的 JSON 对象。这是一个示例响应(此响应可以大得多),其中 pid 是父 id,depth 是与第一个父的距离。
response = [
{uid: "abc", pid: null, depth: 1, parent: true},
{uid: "def", pid: "abc", depth: 2, parent: false},
{uid: "ghi", pid: "abc", depth: 2, parent: true},
{uid: "jkl", pid: "ghi", depth: 3, parent: false},
{uid: "mno", pid: "ghi", depth: 3, parent: false},
]
Run Code Online (Sandbox Code Playgroud)
为了更好地解释上述响应,这里是它的视觉层次结构视图: 图像

到目前为止,我看到的许多答案和解决方案都使用 JSON,每个都嵌套有子级。是否可以使用上面的 json 模型生成视图?
任何帮助或见解将不胜感激!谢谢!
我目前正在尝试配置我使用 AWS Amplify 添加的 REST API。我已经配置了用户身份验证,用户可以按照身份验证文档中概述的步骤注册和登录。然后我使用api 步骤添加了一个 REST API 。
目前,我只是想从 DynamoDB 中检索项目列表。当我在 aws 控制台上测试 api 时它是成功的,但是,当我从我的 android api 进行调用时,它返回以下错误:
{"message":"Authorization header requires 'Credential' parameter. Authorization header requires 'Signature' parameter. Authorization header requires 'SignedHeaders' parameter. Authorization header requires existence of either a 'X-Amz-Date' or a 'Date' header. Authorization=[a long string of characters]
Run Code Online (Sandbox Code Playgroud)
我知道放大会使用 AWS_IAM 自动将 API 设置为受限,我认为这就是返回上述消息的原因。我正在尝试使用我之前通过身份验证步骤设置的用户池对其进行身份验证。我的 android 应用程序中调用 API 的代码如下:
{"message":"Authorization header requires 'Credential' parameter. Authorization header requires 'Signature' parameter. Authorization header requires 'SignedHeaders' parameter. …Run Code Online (Sandbox Code Playgroud) android amazon-cognito aws-api-gateway aws-amplify aws-amplify-sdk-android