in common/src/main/scala/aws/DynamoJsonConversions.scala [24:49]
private def fromAttributeValue(att: AttributeValue): JsValue = List(
Option(att.getS) map parseString,
Option(att.getN) map parseNumber,
Option(att.isBOOL) map parseBool,
Option(att.getL) map parseList,
Option(att.getM) map parseMap,
Option(att.getB) map parseBinary,
Option(att.getSS) map parseStringList,
Option(att.getNS) map parseNumberList,
Option(att.getBS) map parseBinaryList
).flatten.headOption getOrElse JsNull
private def toAttributeValue(obj: JsValue): AttributeValue = {
val att = new AttributeValue()
obj match {
case JsString(s) => att.setS(s)
case JsNumber(n) => att.setN(n.toString())
case JsBoolean(b) => att.setBOOL(b)
case JsNull => att.setNULL(true)
case JsArray(a) => att.setL(a.map(toAttributeValue).asJava)
case JsObject(o) => att.setM(o.view.mapValues(toAttributeValue).toMap.asJava)
case JsFalse => att.setBOOL(false)
case JsTrue => att.setBOOL(true)
}
att
}