Circe具有根据路径修改JSON值的功能:root.order.items.each.quantity.int.modify(_ * 2)
假设我有一个狂喜路径的列表,比如:val paths: List[Vector[Either[Int, String]]] = ...
基于向量路径修改rapture-json的最好方法是什么?
发布于 2017-01-13 00:15:38
您可以这样做:
val newItems =
root.order.items.map { item =>
item.copy(_.quantity = item.quantity.as[Int] * 2, _.name = item.name.toLowerCase)
}
val newRoot = root.copy(_.order.items = newItems)https://stackoverflow.com/questions/39910007
复制相似问题