File tree Expand file tree Collapse file tree 2 files changed +27
-0
lines changed Expand file tree Collapse file tree 2 files changed +27
-0
lines changed Original file line number Diff line number Diff line change 1+ import  $ivy .`com.lihaoyi::requests:0.1.6` 
2+ import  $ivy .`org.json4s::json4s-jackson:3.6.5` 
3+ 
4+ import  org .json4s ._ 
5+ import  org .json4s .jackson .Serialization 
6+ import  org .json4s .jackson .Serialization .{read , write }
7+ 
8+ case  class  Headers (Accept :  String , Host :  String , `User-Agent` : String )
9+ case  class  Body (headers : Headers , origin : String , url : String )
10+ 
11+ val  r  =  requests.get(" http://httpbin.org/get" 
12+ read[Body ](r.text)
Original file line number Diff line number Diff line change 1+ import  $ivy .`org.json4s::json4s-jackson:3.6.5` 
2+ 
3+ import  org .json4s ._ 
4+ import  org .json4s .jackson .Serialization 
5+ import  org .json4s .jackson .Serialization .{read , write }
6+ 
7+ implicit  val  formats  =  Serialization .formats(NoTypeHints )
8+ 
9+ case  class  Person (firstName : String )
10+ write(Person (" joe" 
11+ 
12+ read[Person ]("""  {"firstName": "joe"} """ 
13+ 
14+ case  class  Status (code : Int , error : String )
15+ read[Status ]("""  {"code": 0, "error": null} """ 
                         You can’t perform that action at this time. 
           
                  
0 commit comments