diff options
author | Mathias <mathias@spray.cc> | 2012-01-17 17:22:43 +0100 |
---|---|---|
committer | Mathias <mathias@spray.cc> | 2012-01-19 17:43:33 +0100 |
commit | cfbc301ecaaac325d3a1ad87305107d2cc785b7d (patch) | |
tree | e6ad4b88b94d6d6538835d76a0801425d6d164f7 /src/main/scala/cc/spray/json/package.scala | |
parent | ae6bfb608e007f7d652383e618b9c6af7b726fc7 (diff) | |
download | spray-json-cfbc301ecaaac325d3a1ad87305107d2cc785b7d.tar.gz spray-json-cfbc301ecaaac325d3a1ad87305107d2cc785b7d.tar.bz2 spray-json-cfbc301ecaaac325d3a1ad87305107d2cc785b7d.zip |
Pimp Strings with 'asJson'
Diffstat (limited to 'src/main/scala/cc/spray/json/package.scala')
-rw-r--r-- | src/main/scala/cc/spray/json/package.scala | 8 |
1 files changed, 6 insertions, 2 deletions
diff --git a/src/main/scala/cc/spray/json/package.scala b/src/main/scala/cc/spray/json/package.scala index 1bc592f..ec12939 100644 --- a/src/main/scala/cc/spray/json/package.scala +++ b/src/main/scala/cc/spray/json/package.scala @@ -26,8 +26,8 @@ package object json { def jsonReader[T](implicit reader: JsonReader[T]) = reader def jsonWriter[T](implicit writer: JsonWriter[T]) = writer - implicit def pimpAny[T](any: T): PimpedAny[T] = new PimpedAny(any) - + implicit def pimpAny[T](any: T) = new PimpedAny(any) + implicit def pimpString(string: String) = new PimpedString(string) } package json { @@ -38,4 +38,8 @@ package json { private[json] class PimpedAny[T](any: T) { def toJson(implicit writer: JsonWriter[T]): JsValue = writer.write(any) } + + private[json] class PimpedString(string: String) { + def asJson: JsValue = JsonParser(string) + } }
\ No newline at end of file |