From 9a036938072f23a45b2b552d31f270bb04ada765 Mon Sep 17 00:00:00 2001
From: Akira Tempaku <paku@skyizwhite.dev>
Date: Sun, 20 Apr 2025 22:39:07 +0900
Subject: [PATCH] Use jzon instead of jonathan

---
 qlfile        |  2 +-
 qlfile.lock   |  4 ++--
 src/main.lisp | 12 ++++++++----
 3 files changed, 11 insertions(+), 7 deletions(-)

diff --git a/qlfile b/qlfile
index a7de216..4771eba 100644
--- a/qlfile
+++ b/qlfile
@@ -1,5 +1,5 @@
 ql alexandria
 ql dexador
-ql jonathan
+ql jzon
 ql quri
 ql kebab
diff --git a/qlfile.lock b/qlfile.lock
index 26a1d71..0b9791b 100644
--- a/qlfile.lock
+++ b/qlfile.lock
@@ -10,10 +10,10 @@
  (:class qlot/source/ql:source-ql
   :initargs (:%version :latest)
   :version "ql-2024-10-12"))
-("jonathan" .
+("jzon" .
  (:class qlot/source/ql:source-ql
   :initargs (:%version :latest)
-  :version "ql-2020-09-25"))
+  :version "ql-2024-10-12"))
 ("quri" .
  (:class qlot/source/ql:source-ql
   :initargs (:%version :latest)
diff --git a/src/main.lisp b/src/main.lisp
index bfeb319..67158ba 100644
--- a/src/main.lisp
+++ b/src/main.lisp
@@ -3,9 +3,10 @@
   (:use #:cl)
   (:import-from #:alexandria
                 #:remove-from-plist
-                #:symbolicate)
-  (:import-from #:jonathan
-                #:to-json
+                #:symbolicate
+                #:plist-hash-table)
+  (:import-from #:com.inuoe.jzon
+                #:stringify
                 #:parse)
   (:import-from #:dexador
                 #:request
@@ -34,7 +35,7 @@
                    :method method
                    :headers `(("X-MICROCMS-API-KEY" . ,*api-key*)
                               ("Content-Type" . "application/json"))
-                   :content (and content (to-json content))
+                   :content (%build-content content)
                    :force-binary nil)
         (format t "microCMS status: ~D~%" status)
         (when (and (stringp res-body)
@@ -53,6 +54,9 @@
   (loop :for (key val) :on query :by #'cddr
         :collect (cons (to-camel-case (symbol-name key)) val)))
 
+(defun %build-content (content)
+  (and content (stringify (plist-hash-table content))))
+
 (defmacro define-list-client (endpoint)
   (let ((str-endpoint (string-downcase (string endpoint))))
     `(progn