Small gist with some demo trait that shows an example on how to loop through json
object and change values with circe in Scala
.
Code example you can find below at circe-loop-json-object-example.scala.
The input JSON
for test is kinda in in DynamoDB
dump format:
{
"comment" : {"s" : "something"},
"lat" : {"n" : "10.12312421"},
"price" : {"n" : "123"},
"third" : "normal"
}
And with normalization it will parse each value object and cast to the primitives. Output will be like this:
{
"comment" : "something",
"lat" : 10.12312421,
"price" : 123,
"third" : "normal"
}
Hopefully this gist can be used as example how to traverse through the json
object and change values by using circe
.