【问题标题】:json multidimensional array from Alfresco来自 Alfresco 的 json 多维数组
【发布时间】:2017-09-18 09:06:18
【问题描述】:

我正在尝试使用一个 Alfresco api,它返回有关存储在特定 Alfresco 目录下的一些文档的信息。

我的问题是,在我得到的 Json 上,当我尝试从 cmis:name 返回值时,我遇到了一个欠精细的错误。

我设法达到了“属性”级别,但我无法更进一步。可以请教一下吗?

提前谢谢你。

 success: function (json) {

          $.each(json, function () {
              $.each(this, function (key, value) {
                  console.log(value.object.properties);
              });
              });
      },

【问题讨论】:

    标签: javascript jquery json multidimensional-array alfresco


    【解决方案1】:

    我找到了访问最后一个级别并获取值的正确方法:

    success: function (json) {
    
              $.each(json, function () {
                  $.each(this, function (key, value) {
                      console.log(value.object.properties['cmis:name'].value);
                  });
                  });
          },
    

    【讨论】:

      【解决方案2】:

      您是否这样查询:

      http://localhost:8080/alfresco/s/example/cmis/query?format=json&q=select%20cmis:name,cmis:objectId%20from%20cmis:document%20where%20cmis:name%20=%27testwhitepaper%27

      然后你会得到:

      {"query": "select cmis:name,cmis:objectId from cmis:document where cmis:name ='testwhitepaper'",
      "results": [
      {"name":"testwhitepaper",
       "id":"workspace://SpacesStore/9a007b6a-261a-4d6d-9e34-ded4430ba1ab;1.0"
      },
      {"name":"testwhitepaper",
       "id":"workspace://SpacesStore/3356ff7d-4172-4bd5-a826-adfa541e6ad2;1.0"
      }
      ]
      }
      

      【讨论】:

      猜你喜欢
      • 2016-10-05
      • 2014-11-06
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2018-02-11
      • 1970-01-01
      相关资源
      最近更新 更多