Skip to content

Instantly share code, notes, and snippets.

View srhea's full-sized avatar

Sean Rhea srhea

View GitHub Profile

Keybase proof

I hereby claim:

  • I am srhea on github.
  • I am srhea (https://keybase.io/srhea) on keybase.
  • I have a public key whose fingerprint is B223 C5BF DB06 90B3 1549 B778 5190 14A7 3A79 0824

To claim this, I am signing this object:

@srhea
srhea / JSON.scala
Created November 5, 2012 01:05
A thread-safe version of scala.util.parsing.json.JSON
// A thread-safe version of scala.util.parsing.json.JSON, as suggested
// by Matthew Neeley in response to a question on the Bay Area Scala
// Enthusiasts mailing list. Covered by the standard Scala license.
import scala.util.parsing.json.{ Parser => JSONParser, JSONObject, JSONArray }
class JSON extends JSONParser {
private def resolveType(input: Any): Any = input match {
case JSONObject(map) => map.transform { case (k,v) => resolveType(v) }
case JSONArray(seq) => seq.map(resolveType)