【问题标题】:How to transform Azure Search query result into a table / spreadsheet format如何将 Azure 搜索查询结果转换为表格/电子表格格式
【发布时间】:2019-03-18 11:44:05
【问题描述】:

我使用 Blob 存储来保存来自我的 Botframework v4 Chatbot 的数据。

当我使用 Azure 搜索查询结果时,我得到以下信息:

{
"@odata.context": "https://roboadvisorydatasearch.search.windows.net/indexes('azureblob-index')/$metadata#docs(*)",
"value": [
    {
        "@search.score": 1,
        "content": "{\"id\":\"3470100\",\"realId\":\"3470100\",\"document\":{\"name\":\"pierre\",\"age\":18,\"gender\":\"weiblich\",\"education\":\"Abitur\",\"complete\":true,\"roundCounter\":1,\"riskchoices\":[\"B\"],\"riskAssessmentComplete\":true,\"riskDescription\":\"höchst risikoliebend\",\"order\":[\"0\",\"2\",\"1\"],\"choice\":\"Plus GmbH\",\"follow\":true,\"endRepeat\":true,\"eTag\":\"\\\"0x8D6AB012AE82E05\\\"\",\"loss1\":\"ACG GmbH\",\"win1\":\"Plus GmbH\",\"win2\":\"Breen GmbH\",\"payout\":\"Du bekommst 7000 Geldeinheiten = 7,00€ ausgezahlt.\"}}\n"
    },
    {
        "@search.score": 1,
        "content": "{\"id\":\"159287\",\"realId\":\"159287\",\"document\":{\"name\":\"A18\",\"age\":18,\"gender\":\"weiblich\",\"education\":\"Abitur\",\"complete\":true,\"roundCounter\":7,\"riskchoices\":[\"A\",\"A\",\"A\",\"A\",\"A\",\"A\",\"B\"],\"riskAssessmentComplete\":true,\"riskDescription\":\"risikoavers\",\"order\":[\"1\",\"2\",\"0\"],\"choice\":\"ACG GmbH\",\"follow\":false,\"endRepeat\":true,\"eTag\":\"\\\"0x8D6A94E40672463\\\"\",\"win1\":\"Breen GmbH\",\"win2\":\"Plus GmbH\",\"loss2\":\"ACG GmbH\",\"payout\":\"Du bekommst 5000 Geldeinheiten = 5,00€ ausgezahlt.\"}}\n"
    }
]
}

我想要的是一个表格/电子表格(例如,我可以在 Excel 中使用)。每个结果应该是连续的,并且列应该是每个“内容”内 JSON 的键。这个website 效果很好,但前提是我将对象插入“内容”中。但是对每一行都这样做会很费力。

【问题讨论】:

    标签: json azure azure-cognitive-search azure-blob-storage


    【解决方案1】:

    我们的 API 不支持以 csv 格式返回结果。您需要自己转换响应。

    C# 示例解决方案:JSON string to CSV and CSV to JSON conversion in c#

    JavaScript 示例解决方案:How to convert JSON to CSV format and store in a variable

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2012-02-05
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多