json - json4s object extraction with extra data -
I am using spray with json4s, and to handle items placed to update items, Implementation is found ... My problem with it is that I first used an example of some objects from JSN, but being a cool API, I want to specify an ID in the URL. Then I have to make another example of some object which is indexed with ID ... To do this, I am using a constructor like some object (id: long, obg: some object). It works well, but the implementation is ugly and it seems unworthy. What can I do so why can I paste the ID in some way so that I can make an example of only some objects?
I find a solution for this around through docs For a while after digging on behalf:
ApplicationRouter BaseRouter {val = routes PathPrefix ( "a path") {path ( "destination resources" \ IntNumber) {id = & gt extends entity (as [Jobik]) {rawData = & gt; Value extractedObject = rawData.camelizeKeys.merge {("id", id)} .extract [SomeObject] handleRequest (extractedObject)}}}
Comments
Post a Comment