I have simple Json:
val str = """{"test":"123"}"""
How I can modify String
"123"
to Int
123
to get new Json?:
{"test":123}
Now I am using:
val json = parse(str).getOrElse(Json.Null)
val jsObj = json.asObject.get // Unsafe, just example
val newJson = Json.fromJsonObject(jsObj.remove("test").add("test", Json.fromInt(123)))
But this code is not pretty.
Is it possible to make this code prettier or maybe do it via circe optics?