docs(lib): narrate table/text/json as code-as-docs pilot
Add purpose lines and bracket-call examples in EN/ZH libs and public/stdlib demos; keep explicit + params so function-body prose cannot be mistaken for link-index or bold code. Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
1 parent
0e0655b316
commit
53bc3538da
13 files changed
+238
-89
No files matched your search
+19
-1
@@ -1,33 +1,47 @@
|
||||
---
|
||||
title: lib/json
|
||||
description: JSON parse/stringify (shared EN/ZH import)
|
||||
description: JSON parse/stringify (shared EN/ZH import). Not a dict builder — use lib/table.
|
||||
---
|
||||
|
||||
Parse and stringify JSON. For maps/lists prefer GFM tables and lib/table put; do not chain json.set / json.append in new code.
|
||||
|
||||
## parse
|
||||
+ `text`
|
||||
|
||||
Parse JSON text into a Marqdo value.
|
||||
|
||||
Caller: [json.parse] text="{}"
|
||||
|
||||
*> host_json_parse text=`text`*
|
||||
|
||||
## stringify
|
||||
+ `value`
|
||||
+ `indent`=None
|
||||
|
||||
Serialize value to JSON text; optional indent.
|
||||
|
||||
*> host_json_stringify value=`value` indent=`indent`*
|
||||
|
||||
## get
|
||||
+ `value`
|
||||
+ `key`
|
||||
|
||||
Shallow get from JSON object value at key. Prefer link-index get or table.get in new code.
|
||||
|
||||
*> host_json_get value=`value` key=`key`*
|
||||
|
||||
## keys
|
||||
+ `value`
|
||||
|
||||
Keys of JSON object value.
|
||||
|
||||
*> host_json_keys value=`value`*
|
||||
|
||||
## quote
|
||||
+ `text`
|
||||
|
||||
JSON-quote string text (for building request bodies).
|
||||
|
||||
*> host_json_quote text=`text`*
|
||||
|
||||
## set
|
||||
@@ -35,10 +49,14 @@ description: JSON parse/stringify (shared EN/ZH import)
|
||||
+ `key`
|
||||
+ `value`
|
||||
|
||||
Compatibility shallow set. Prefer table.put / table.set.
|
||||
|
||||
*> host_map_set map=`map` key=`key` value=`value`*
|
||||
|
||||
## append
|
||||
+ `list`
|
||||
+ `item`
|
||||
|
||||
Compatibility append. Prefer table.append.
|
||||
|
||||
*> host_list_append list=`list` item=`item`*
|
||||
Reference in new issue
Block a user