次の方法で共有


Json.Document

構文

Json.Document(jsonText as any, optional encoding as nullable number) as any

バージョン情報

JSON ドキュメントの内容を返します。

  • jsonText: JSON ドキュメントの内容。 このパラメーターの値には、テキストまたは File.Content などの関数によって返されるバイナリ値を指定できます。
  • encoding: JSON ドキュメントで使用されるエンコードを指定する TextEncoding.Typeencodingを省略すると、UTF8 が使用されます。

例 1

指定した JSON テキストの内容をレコードとして返します。

使用方法

let
    Source = "{
        ""project"": ""Contosoware"",
        ""description"": ""A comprehensive initiative aimed at enhancing digital presence."",
        ""components"": [
            ""Website Development"",
            ""CRM Implementation"",
            ""Mobile Application""
        ]
    }",
    jsonDocument = Json.Document(Source)
in
    jsonDocument

アウトプット

[
    project = "Contosoware",
    description = "A comprehensive initiative aimed at enhancing digital presence."
    components =
    {
        "Website Development",
        "CRM Implementation",
        "Mobile Application"
    }
]

例 2

ローカル JSON ファイルの内容を返します。

使用方法

let
    Source = (Json.Document(
        File.Contents("C:\test-examples\JSON\Contosoware.json")
    )
in
    Source

アウトプット

ファイルに含まれる JSON データを表すレコード、リスト、またはプリミティブ値

例 3

オンライン UTF16 でエンコードされた JSON ファイルの内容を返します。

使用方法

let
    Source = Json.Document(
        Web.Contents("htts://contoso.com/products/Contosoware.json"),
        TextEncoding.Utf16)
    )

アウトプット

ファイルに含まれる JSON UTF16 データを表すレコード、リスト、またはプリミティブ値