1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
| # * 完整例子
(json-encode `((:model . "moonshot-v1-8k")
(:messages .
(((:role . "system")
(:content . "you are a helpful assitant"))
((:role . "user")
(:content . "why 1 + 1 not equals 2?"))
))))
# * 单个字段定义
(json-encode `((:role . "system")))
# {"role": "system"}
# * 多个字段定义
(json-encode `((:role . "system") (:id . 3)))
# {"role": "system", "id": 3}
# * 数组定义
(json-encode `(1 2 3))
# [1, 2, 3]
# * 数组字段定义
(json-encode `((:my_array . (1 2 3))))
# {"my_array": [1, 2, 3]}
# * 总结
# ** list --> 数组(python list)
# ** list of cons cell --> 字典
|