簡體   English   中英

使用U-SQL在C#對象中加載JSON文件

[英]Load a JSON file in a C# object using U-SQL

我在Data Lake Store中存儲了一個JSON文件。 我可以使用Microsoft的JsonExtractor提取JSON文件。

是否可以在不使用EXTRACT命令的情況下在POCO對象中加載JSON文件? 如果我使用EXTRACT命令,是否可以將所有行合並到一個C#對象中?

下面是一個示例JSON文件,我想反序列化並將其存儲在C#對象中

{
  "sourcePath": "wasb://container@accountName.blob.core.net/Input/{*}.txt",
  "destinationPath": "wasb://container@accountName.blob.core.net/Output/myfile.txt",
  "errorPath": "wasb://container@accountName.blob.core.net/Error/error.txt",
  "schema": [
    {
      "name": "column1",
      "type": "string",
      "allowNull": true,
      "minLength": 12,
      "maxLength": 50
    },
    {
      "name": "column2",
      "type": "int",
      "allowNull": true,
      "minLength": 0,
      "maxLength": 0
    },
    {
      "name": "column3",
      "type": "bool",
      "allowNull": true,
      "minLength": 0,
      "maxLength": 0
    },
    {
      "name": "column4",
      "type": "DateTime",
      "allowNull": false,
      "minLength": 0,
      "maxLength": 0
    }
  ]
}

您可以編寫自己的自定義提取程序來讀取數據(input.baseStream),然后可以創建對象。 看一下該模式的Microsoft JSON提取器。

請注意,提取器的主內存限制為1/2 GB。

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM