Is there a straight forward way to format a JSON string in scala?
I have a JSON String like this:
val json = {\"foo\": {\"bar\": {\"baz\": T}}}
I thought I read somewhere that Typesafe was considering separating their JSON processing out of Play, so look into that to apply @senia's solution first.
Otherwise, look at Jackson--or more precisely, the Scala wrapper for Jackson:
val mapper = new ObjectMapper()
mapper.registerModule(DefaultScalaModule)
val writer = mapper.writerWithDefaultPrettyPrinter
val json = writer.writeValueAsString(Object value)
I've also heard that the kids are really into Scala Pickling, which apparently has pretty printing as well.