(def json-parser
~{:null (/ (<- "null") ,|[$ :null])
:bool (/ (<- (+ "true" "false")) ,|[$ :bool])
:number (/ (<- (* (? "-") :d+ (? (* "." :d+)))) ,|[$ :number])
:string (/ (* "\"" (<- (to (* (> -1 (not "\\")) "\"")))
(* (> -1 (not "\\")) "\"")) ,|[$ :string])
:array (/ (* "[" :value (any (* :s* "," :value)) "]") ,|[$& :array])
:object (/ (* "{" :s* :string :s* ":" :value
(any (* :s* "," :s* :string :s* ":" :value))
"}") ,|[(from-pairs (partition 2 $&)) :object])
:value (* :s* (+ :null :bool :number :string :array :object) :s*)
:unmatched (/ (<- (some 1)) ,|[$ :unmatched])
:main (some (+ :value "\n" :unmatched))})