diff options
| author | eltrac <hi@eltr.ac> | 2026-09-20 20:38:27 +0800 |
|---|---|---|
| committer | eltrac <hi@eltr.ac> | 2026-09-20 20:38:27 +0800 |
| commit | 70f820f50767b8fbbd4322578d8f67975cf2c814 (patch) | |
| tree | 50dac9020542c522c444fec0977f3b42300e5ca4 /src | |
| parent | c6401e5397807622bac4860b84fb31003fcd5d31 (diff) | |
clj: convert json string to clojure map with keywords
Diffstat (limited to 'src')
| -rw-r--r-- | src/mf2clj/core.clj | 9 |
1 files changed, 7 insertions, 2 deletions
diff --git a/src/mf2clj/core.clj b/src/mf2clj/core.clj index 8d655b1..fd26203 100644 --- a/src/mf2clj/core.clj +++ b/src/mf2clj/core.clj @@ -1,5 +1,7 @@ (ns mf2clj.core
- (:require [clojure.java.io :as io])
+ (:require [clojure.java.io :as io]
+ [clojure.walk :refer [keywordize-keys]]
+ [cheshire.core :as json])
(:import [org.extism.sdk.chicory Manifest ManifestWasm Plugin]
[java.nio.charset StandardCharsets]))
@@ -15,5 +17,8 @@ (defn parse [html-string]
(let [charset StandardCharsets/UTF_8
html-bytes (.getBytes html-string charset)]
- (String. (.call plugin "parse" html-bytes) charset)))
+ (-> (.call plugin "parse" html-bytes)
+ (String. charset)
+ json/parse-string
+ keywordize-keys)))
|
