Skip to content

Instantly share code, notes, and snippets.

@edw
Created June 13, 2011 17:07
Show Gist options
  • Select an option

  • Save edw/1023199 to your computer and use it in GitHub Desktop.

Select an option

Save edw/1023199 to your computer and use it in GitHub Desktop.
Add support for writing regex patterns to JSON-STR
(ns foo
(:use [clojure.contrib json]))
(extend java.util.regex.Pattern
json/Write-JSON
{:write-json (fn [re w] (.write w (json-str (.pattern re))))})
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment