summaryrefslogtreecommitdiff
path: root/devdocs/elisp/jsonrpc-json-object-format.html
diff options
context:
space:
mode:
Diffstat (limited to 'devdocs/elisp/jsonrpc-json-object-format.html')
-rw-r--r--devdocs/elisp/jsonrpc-json-object-format.html15
1 files changed, 15 insertions, 0 deletions
diff --git a/devdocs/elisp/jsonrpc-json-object-format.html b/devdocs/elisp/jsonrpc-json-object-format.html
new file mode 100644
index 00000000..6ccf6cb5
--- /dev/null
+++ b/devdocs/elisp/jsonrpc-json-object-format.html
@@ -0,0 +1,15 @@
+ <h4 class="subsection">JSONRPC JSON object format</h4> <p>JSONRPC JSON objects are exchanged as Lisp plists (see <a href="property-lists">Property Lists</a>): JSON-compatible plists are handed to the dispatcher functions and, likewise, JSON-compatible plists should be given to <code>jsonrpc-notify</code>, <code>jsonrpc-request</code>, and <code>jsonrpc-async-request</code>. </p> <p>To facilitate handling plists, this library makes liberal use of <code>cl-lib</code> library (see <a href="https://www.gnu.org/software/emacs/manual/html_node/cl/index.html#Top">cl-lib</a> in <cite>Common Lisp Extensions for GNU Emacs Lisp</cite>) and suggests (but doesn’t force) its clients to do the same. A macro <code>jsonrpc-lambda</code> can be used to create a lambda for destructuring a JSON-object like in this example: </p> <div class="example"> <pre class="example">(jsonrpc-async-request
+ myproc :frobnicate `(:foo "trix")
+ :success-fn (jsonrpc-lambda (&amp;key bar baz &amp;allow-other-keys)
+ (message "Server replied back with %s and %s!"
+ bar baz))
+ :error-fn (jsonrpc-lambda (&amp;key code message _data)
+ (message "Sadly, server reports %s: %s"
+ code message)))
+</pre>
+</div><div class="_attribution">
+ <p class="_attribution-p">
+ Copyright &copy; 1990-1996, 1998-2022 Free Software Foundation, Inc. <br>Licensed under the GNU GPL license.<br>
+ <a href="https://www.gnu.org/software/emacs/manual/html_node/elisp/JSONRPC-JSON-object-format.html" class="_attribution-link">https://www.gnu.org/software/emacs/manual/html_node/elisp/JSONRPC-JSON-object-format.html</a>
+ </p>
+</div>