diff options
author | Johannes Rudolph <johannes.rudolph@gmail.com> | 2014-03-12 14:35:24 +0100 |
---|---|---|
committer | Johannes Rudolph <johannes.rudolph@gmail.com> | 2014-03-12 14:36:48 +0100 |
commit | df6863a973b1a2ded68e07eddbb9a2baa8daf169 (patch) | |
tree | e0a99df5e9b7015e924e50f4c7c13550727e476d /src | |
parent | 43d37d7cc08bb25957e6692baae0856ca1f522d4 (diff) | |
download | spray-json-df6863a973b1a2ded68e07eddbb9a2baa8daf169.tar.gz spray-json-df6863a973b1a2ded68e07eddbb9a2baa8daf169.tar.bz2 spray-json-df6863a973b1a2ded68e07eddbb9a2baa8daf169.zip |
rename asJson => parseJson, fixes #89
Diffstat (limited to 'src')
-rw-r--r-- | src/main/scala/spray/json/package.scala | 4 | ||||
-rw-r--r-- | src/test/scala/spray/json/AdditionalFormatsSpec.scala | 2 | ||||
-rw-r--r-- | src/test/scala/spray/json/CustomFormatSpec.scala | 2 | ||||
-rw-r--r-- | src/test/scala/spray/json/ReadmeSpec.scala | 2 |
4 files changed, 6 insertions, 4 deletions
diff --git a/src/main/scala/spray/json/package.scala b/src/main/scala/spray/json/package.scala index 5bf5714..fe37c8b 100644 --- a/src/main/scala/spray/json/package.scala +++ b/src/main/scala/spray/json/package.scala @@ -40,6 +40,8 @@ package json { } private[json] class PimpedString(string: String) { - def asJson: JsValue = JsonParser(string) + @deprecated("deprecated in favor of parseJson", "1.2.6") + def asJson: JsValue = parseJson + def parseJson: JsValue = JsonParser(string) } }
\ No newline at end of file diff --git a/src/test/scala/spray/json/AdditionalFormatsSpec.scala b/src/test/scala/spray/json/AdditionalFormatsSpec.scala index 7129fdf..eafceb2 100644 --- a/src/test/scala/spray/json/AdditionalFormatsSpec.scala +++ b/src/test/scala/spray/json/AdditionalFormatsSpec.scala @@ -51,7 +51,7 @@ class AdditionalFormatsSpec extends Specification { "properly read a Container[Container[List[Int]]] from JSON" in { import ReaderProtocol._ - """{"content":{"content":[1,2,3]}}""".asJson.convertTo[Container[Container[List[Int]]]] mustEqual obj + """{"content":{"content":[1,2,3]}}""".parseJson.convertTo[Container[Container[List[Int]]]] mustEqual obj } } diff --git a/src/test/scala/spray/json/CustomFormatSpec.scala b/src/test/scala/spray/json/CustomFormatSpec.scala index dcea4f2..2397abc 100644 --- a/src/test/scala/spray/json/CustomFormatSpec.scala +++ b/src/test/scala/spray/json/CustomFormatSpec.scala @@ -35,7 +35,7 @@ class CustomFormatSpec extends Specification with DefaultJsonProtocol { "A custom JsonFormat built with 'asJsonObject'" should { val value = MyType("bob", 42) "correctly deserialize valid JSON content" in { - """{ "name": "bob", "value": 42 }""".asJson.convertTo[MyType] mustEqual value + """{ "name": "bob", "value": 42 }""".parseJson.convertTo[MyType] mustEqual value } "support full round-trip (de)serialization" in { value.toJson.convertTo[MyType] mustEqual value diff --git a/src/test/scala/spray/json/ReadmeSpec.scala b/src/test/scala/spray/json/ReadmeSpec.scala index 89d3dbc..51a1ec5 100644 --- a/src/test/scala/spray/json/ReadmeSpec.scala +++ b/src/test/scala/spray/json/ReadmeSpec.scala @@ -25,7 +25,7 @@ class ReadmeSpec extends Specification { import DefaultJsonProtocol._ val source = """{ "some": "JSON source" }""" - val jsonAst = source.asJson + val jsonAst = source.parseJson jsonAst mustEqual JsObject("some" -> JsString("JSON source")) val json2 = jsonAst.prettyPrint |