Note

Access to this page requires authorization. You can try signing in or .

Access to this page requires authorization. You can try .

Json.Document

Syntax

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

About

Returns the content of the JSON document.

  • jsonText: The content of the JSON document. The value of this parameter can be text or a binary value returned by a function like File.Contents.
  • encoding: A TextEncoding.Type that specifies the encoding used in the JSON document. If encoding is omitted, UTF8 is used.

Example 1

Returns the content of the specified JSON text as a record.

Usage

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

Output

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

Example 2

Returns the content of a local JSON file.

Usage

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

Output

A record, list, or primitive value representing the JSON data contained in the file

Example 3

Returns the content of an online UTF16 encoded JSON file.

Usage

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

Output

A record, list, or primitive value representing the JSON UTF16 data contained in the file


Feedback

Was this page helpful?

Additional resources