Skip to content
Browse files

Merge branch 'hotfix/0.1.6'

  • Loading branch information...
2 parents 48070d1 + 8963d17 commit 378cef647cb1aca269f4f40b349c8e1d7c857179 @codahale committed Feb 18, 2011
View
5 CHANGELOG.md
@@ -1,3 +1,8 @@
+v0.1.6: Feb 18 2011
+===================
+
+* Serialize `None` instances to `null`. (h/t Alex Cruise again)
+
v0.1.5: Feb 18 2011
===================
View
2 README.md
@@ -22,7 +22,7 @@ In your [simple-build-tool](http://code.google.com/p/simple-build-tool/) project
file, add Jerkson as a dependency:
val codaRepo = "Coda Hale's Repository" at "http://repo.codahale.com/"
- val jerkson = "com.codahale" %% "jerkson" % "0.1.5" withSources()
+ val jerkson = "com.codahale" %% "jerkson" % "0.1.6" withSources()
Parsing JSON
View
2 project/build.properties
@@ -3,6 +3,6 @@
project.organization=com.codahale
project.name=jerkson
sbt.version=0.7.5.RC0
-project.version=0.1.5
+project.version=0.1.6
build.scala.versions=2.8.1
project.initialize=false
View
2 src/main/scala/com/codahale/jerkson/ser/OptionSerializer.scala
@@ -10,6 +10,8 @@ class OptionSerializer extends JsonSerializer[Option[_]] {
val obj = value.get.asInstanceOf[Object]
val serializer = provider.findValueSerializer(obj.getClass)
serializer.serialize(obj, json, provider)
+ } else {
+ json.writeNull()
}
}
}
View
4 src/test/scala/com/codahale/jerkson/tests/JsonGenerationSpec.scala
@@ -105,8 +105,8 @@ object JsonGenerationSpec extends Spec {
}
class `A None` {
- def `should not generate anything` {
- generate(None) must beEqualTo("")
+ def `should generate a JSON null` {
+ generate(None) must beEqualTo("null")
}
}

0 comments on commit 378cef6

Please sign in to comment.
Something went wrong with that request. Please try again.