cl-defstruct 定义出来的不能使用 json-encode 吗

  1. 第一时间应该看文档。

    文档明确了 json-encode 接受的对象:

    (json-encode OBJECT)
    
    Return a JSON representation of OBJECT as a string.
    
    OBJECT should have a structure like one returned by ‘json-read’.
    
    (json-read)
    
    Parse and return the JSON object following point.
    Advances point just past JSON object.
    
    If called with the following JSON after point
    
      {"a": [1, 2, {"c": false}],
       "b": "foo"}
    
    you will get the following structure returned:
    
      ((a .
          [1 2
             ((c . :json-false))])
       (b . "foo"))
    
  2. 帖子里的代码应该放在 ```{lang}```

  3. 安装 xuchunyang 大佬的 elisp-demos,然后你在看文档的同时也能看到使用范例。