Hello guys, I have build a small test API to learn how to receive and respond with JSON formatted documents. I have managed to make it work but I do not think I am using the most appropriate classes in my example.
This is the example: def jsonTest(req: Req): LiftResponse = { import net.liftweb.json.JsonAST._ import net.liftweb.json.Printer.pretty implicit val formats = net.liftweb.json.DefaultFormats // Brings in default date formats etc. case class Person(name: String, password: String) val json = parse(req.body.map(bytes => new String(bytes, "UTF-8")) openOr "") val person = json.extract[Person] Log.info(person.name) PlainTextResponse(pretty(render(json))) } I am receiving a JSON document. I parse it and I place it inside of a json object. Then I print one field in the log to check that the extraction was ok, and I respond with the very same document as plain text. The client receives the document again without problems. My question is about the response. Is it ok to respond as plain text? Or is it a more direct way to do it? Thanks in advance, GA --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Lift" group. To post to this group, send email to liftweb@googlegroups.com To unsubscribe from this group, send email to liftweb+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/liftweb?hl=en -~----------~----~----~----~------~----~------~--~---