Closed lexicalunit closed 7 years ago
As compiler says you dont have JsonWriter for scala.collection.immutable.Map[String,Object]
.
Likely you dont have JsonWriter for Object
(Error:(163, 17) not enough arguments).
You need to build map with Serializable type: Map[K: JsonWriter, V: JsonWriter]; Map[String, String] for exmple, but not Map[String, Object].
One of variant is do this (e is Map[String, JsValue]
):
val e = Map(
"user" -> Map(
"domain" -> item.domain.toJson,
"id" -> item.userId.toJson
).toJson,
"manufacturer" -> item.manufacturer.toJson,
"model" -> item.model.toJson,
"serial_number" -> item.serialNumber.toJson,
"attributes" -> Map(
"advertised_name" -> item.advertisedName.toJson,
"bluetooth_device_address" -> item.bluetoothDeviceAddress.toJson,
"mac_address" -> item.macAddress.toJson,
"firmware_version" -> item.firmwareVersion.toJson,
"hardware_version" -> item.hardwareVersion.toJson
).toJson
)
Thanks @klpx! Closing ticket.
I'm just trying to convert a simple
Map
into JSON (typeString
):I am getting an error on the
e.toJson
line: