> ## 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.parse

> Parse JSON string ด้วย function เดียวกับ json.decode.

<div className="real-function-page">
  ```lua theme={null}
  json.parse(json: string, options?: DecodeOptions): any
  ```

  ## Arguments

  <ParamField path={"json"} type={"string"} required>
    JSON string ที่จะ parse. function อ่าน argument นี้ด้วย string type checking.
  </ParamField>

  <ParamField path={"options"} type={"DecodeOptions"}>
    Optional decode options. boolean ตั้งค่า useNull. table ตั้งค่า useNull และ maxDepth ได้.
  </ParamField>

  ## Returns

  <ResponseField name={"decoded"} type={"any"}>
    Decoded value. JSON objects และ arrays กลายเป็น tables พร้อม JSON type markers, strings กลายเป็น Lua strings, numbers กลายเป็น Lua numbers, booleans กลายเป็น booleans, และ null กลายเป็น json.null เว้นแต่ useNull เป็น false.
  </ResponseField>

  ## Types

  ### DecodeOptions

  ควบคุมพฤติกรรมการแยกวิเคราะห์ JSON

  | Name | Type | Required | คำอธิบาย |
  | - | - | - | - |
  | `useNull` | `boolean` | No | แสดงถึง JSON null ด้วย null sentinel ของไลบรารีแทนที่จะเป็น nil |
  | `maxDepth` | `integer` | No | ตั้งค่าความลึกของการซ้อนสูงสุด โดยยึดไว้ตั้งแต่ 1 ถึง 4096 |

  ## ตัวอย่าง

  Parse JSON ด้วย function เดียวกับที่ json.decode ใช้.

  ```lua theme={null}
  local settings = json.parse('{"volume":0.75,"theme":"dark","missing":null}', {
      useNull = true,
  })

  print(settings.volume)
  print(settings.theme)
  print(json.isNull(settings.missing))
  ```
</div>


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.