> ## Documentation Index
> Fetch the complete documentation index at: https://docs.projectreal.gg/llms.txt
> Use this file to discover all available pages before exploring further.

# json.array

> 为 json.encode 创建一个标记为 JSON array 的 new table，并在提供 source table 时复制 1.#source sequence。

<div className="real-function-page">
  ```lua theme={null}
  json.array(source?: table): table
  ```

  ## 参数

  <ParamField path={"source"} type={"table"}>
    Optional source table。省略或为 nil 时，json.array 返回 new empty array-marked table。提供时，只会把 1 with #source 的 numeric sequence entries 复制到 new table。
  </ParamField>

  ## 返回值

  <ResponseField name={"array"} type={"table"}>
    带有 JSON array marker 的 new table。json.encode 会将其 serializes 为 JSON array；不会返回 original source table。
  </ResponseField>

  ## 示例

  创建 array-marked copy，让 json.encode 将该值 serializes 为 JSON array。

  ```lua theme={null}
  local tags = json.array({ "api", "docs", "luau" })
  local empty = json.array()

  print(json.encode(tags))
  print(json.encode(empty))
  print(json.type(empty))
  ```
</div>
