Skip to content

daninus14/jzon-util

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

9 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

jzon-util

These are utilities for using com.inuoe.jzon

Functionality

sensitive-metaclass

This provides a slot option called :sensitve which will make that slot not be json encoded.

To check if a slot is sensitve do sensitive-slot-value on a given slot.

(ql:quickload "com.inuoe.jzon")

(defclass c1 ()
  ((name :accessor name :initarg :name :initform nil)
   (secret :accessor secret :initarg :secret :initform nil)
   (hello :accessor hello :initarg :hello :initform nil)))

(com.inuoe.jzon:stringify (make-instance 'c1 :name "john" :secret "hello world!" :hello "Miami"))
;; "{\"name\":\"john\",\"secret\":\"hello world!\",\"hello\":\"Miami\"}"

(ql:quickload "jzon-util")

(defclass c3 ()
  ((name :accessor name :initarg :name :initform nil)
   (secret :accessor secret :initarg :secret :initform nil :sensitive t)
   (hello :accessor hello :initarg :hello :initform nil))
  (:metaclass jzon-util:sensitive-metaclass))

(com.inuoe.jzon:stringify (make-instance 'c3 :name "john" :secret "hello world!" :hello "Miami"))
;; "{\"name\":\"john\",\"hello\":\"Miami\"}"

Notice that the second time, the secret was not encoded in the json.

TODO make this depends on cl-sensitive and remove the duplicated code

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published