Skip to content

Commit ef11382

Browse files
committed
Add example code for json.null
1 parent 75d4083 commit ef11382

File tree

2 files changed

+7
-2
lines changed

2 files changed

+7
-2
lines changed

docs/Runtime Environment/Library Reference/JSON.md

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -64,4 +64,9 @@ assert(decoded.nested.nested_key == 1337)
6464
```
6565
---
6666
## Encoding Null Values
67-
The `json.null` value — assuming you did `local json = require("json")` — can be used to encode null JSON values.
67+
The `json.null` value — assuming you did `local json = require("json")` — can be used to encode null JSON values.
68+
```pluto
69+
local json = require("json")
70+
71+
print(json.encode(json.null)) --> null
72+
```

src/theme/pluto.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ Prism.languages.pluto = {
55
/\b(?!in\s)(?!\d)(?!return)(?!case)(?!function)(?!local)(?!new)\w+(?=\s*(?:\??\())/, // func()
66
/\b(?!in\s)(?!\d)(?!return)(?!case)(?!function)(?!local)(?!not)\w+(?=\s*(?:\??[{"]))/, // func "", func {}
77
/\b(function|enum|class)\b/,
8-
/\b(debug|table|string|number|io|os|coroutine|_VERSION|_PVERSION|_PSOUP)\b/, // standard library + type hints
8+
/\b(debug|table|string|number|io|os|coroutine|_VERSION|_PVERSION|_PSOUP|json\.null)\b/, // standard library + type hints
99
],
1010
'attr-value': /<(const|constexpr|close)>/,
1111
'string': {

0 commit comments

Comments
 (0)