Repository: rustless/rustless (language: rust)

Issue:
Update dependencies
 im on the latest rustless version (v0.7.3)

```
    Name                                   Project Ver  SemVer Compat  Latest Ver
    rustless->bodyparser                      0.0.6          --          0.4.1
    rustless->cookie                          0.2.5          --          0.3.0
    rustless->hyper                           0.8.1        0.9.10        0.9.10
    rustless->iron                            0.3.1        0.4.0         0.4.0
    rustless->jsonway                         0.3.5          --          1.0.0
    rustless->lazy_static                     0.1.16         --          0.2.1
    rustless->queryst                         0.1.16         --          1.0.0
    rustless->traitobject                     0.0.1        0.0.3         0.0.3
    rustless->url                             0.5.9        1.2.0         1.2.0
    rustless->valico                          0.8.2          --          1.0.0
```



Discussion / hints:

Fix patch:
diff --git a/Cargo.toml b/Cargo.toml
index 595efa02..74a3382e 100644
--- a/Cargo.toml
+++ b/Cargo.toml
@@ -24,30 +24,31 @@ iron_backend = ["iron", "bodyparser", "plugin"]
 
 [dependencies]
 regex = "0.1"
-lazy_static = "0.1"
-rustc-serialize = "0.3"
-valico = "0.8"
-hyper = "0.8"
-queryst = "0.1"
-jsonway = "0.3"
-url = "0.5"
+lazy_static = "0.2"
+valico = "1"
+hyper = "0.9"
+queryst = "1"
+jsonway = "1"
+url = "1"
 error = "0.1"
 typemap = "0.3"
 log = "0.3"
 typeable = "0.1"
 traitobject = "0.0"
+serde = "0.8"
+serde_json = "0.8"
 
 [dependencies.cookie]
-version = "0.2"
+version = "0.3"
 default-features = false
 
 [dependencies.iron]
 optional = true
-version = "0.3"
+version = "0.4"
 
 [dependencies.bodyparser]
 optional = true
-version = "0.3"
+version = "0.4"
 
 [dependencies.plugin]
 optional = true
diff --git a/examples/simple.rs b/examples/simple.rs
index bcd2fe88..f6cc2b18 100644
--- a/examples/simple.rs
+++ b/examples/simple.rs
@@ -3,9 +3,9 @@ extern crate rustless;
 
 extern crate iron;
 extern crate url;
-extern crate rustc_serialize as serialize;
+extern crate serde;
+extern crate serde_json;
 extern crate valico;
-extern crate cookie;
 
 use std::fmt;
 use std::error;
@@ -15,7 +15,7 @@ use valico::json_dsl;
 use rustless::server::status;
 use rustless::errors::{Error};
 use rustless::batteries::swagger;
-use rustless::batteries::cookie::CookieExt;
+use rustless::batteries::cookie::{Cookie, CookieExt};
 use rustless::{Nesting};
 
 #[derive(Debug)]
@@ -88,7 +88,7 @@ fn main() {
 
                 match params.find("token") {
                     // We can unwrap() safely because token in validated already
-                    Some(token) => if token.as_string().unwrap() == "password1" { return Ok(()) },
+                    Some(token) => if token.as_str().unwrap() == "password1" { return Ok(()) },
                     None => ()
                 }
 
@@ -109,7 +109,7 @@ fn main() {
                         let cookies = client.request.cookies();
                         let signed_cookies = cookies.signed();
 
-                        let user_cookie = cookie::Cookie::new("session".to_string(), "verified".to_string());
+                        let user_cookie = Cookie::new("session".to_string(), "verified".to_string());
                         signed_cookies.add(user_cookie);
                     }
 
diff --git a/src/backend/iron.rs b/src/backend/iron.rs
index 7969a04d..5805271c 100644
--- a/src/backend/iron.rs
+++ b/src/backend/iron.rs
@@ -31,14 +31,14 @@ impl WrapUrl for url::Url {
 }
 
 impl backend::AsUrl for Url {
-    fn scheme(&self) -> &str { &self.scheme }
-    fn host(&self) -> &url::Host { &self.host }
-    fn port(&self) -> &u16 { &self.port }
-    fn path(&self) -> &Vec<String> { &self.path }
-    fn username(&self) -> &Option<String> { &self.username }
-    fn password(&self) -> &Option<String> { &self.password }
-    fn query(&self) -> &Option<String> { &self.query }
-    fn fragment(&self) -> &Option<String> { &self.fragment }
+    fn scheme(&self) -> &str { &self.scheme() }
+    fn host(&self) -> url::Host<&str> { self.host() }
+    fn port(&self) -> u16 { self.port() }
+    fn path(&self) -> Vec<&str> { self.path() }
+    fn username(&self) -> Option<&str> { self.username() }
+    fn password(&self) -> Option<&str> { self.password() }
+    fn query(&self) -> Option<&str> { self.query() }
+    fn fragment(&self) -> Option<&str> { self.fragment() }
 }
 
 impl<'a, 'b> backend::Request for iron::Request<'a, 'b> {
diff --git a/src/backend/request.rs b/src/backend/request.rs
index 851b557b..162ecab8 100644
--- a/src/backend/request.rs
+++ b/src/backend/request.rs
@@ -15,13 +15,13 @@ impl Body for Box<io::Read + 'static> { }
 
 pub trait AsUrl {
     fn scheme(&self) -> &str;
-    fn host(&self) -> &url::Host;
-    fn port(&self) -> &u16;
-    fn path(&self) -> &Vec<String>;
-    fn username(&self) -> &Option<String>;
-    fn password(&self) -> &Option<String>;
-    fn query(&self) -> &Option<String>;
-    fn fragment(&self) -> &Option<String>;
+    fn host(&self) -> url::Host<&str>;
+    fn port(&self) -> u16;
+    fn path(&self) -> Vec<&str>;
+    fn username(&self) -> Option<&str>;
+    fn password(&self) -> Option<&str>;
+    fn query(&self) -> Option<&str>;
+    fn fragment(&self) -> Option<&str>;
 }
 
 pub trait Request: fmt::Debug + ::Extensible {
diff --git a/src/backend/response.rs b/src/backend/response.rs
index 26dacf3d..718e5bc8 100644
--- a/src/backend/response.rs
+++ b/src/backend/response.rs
@@ -1,5 +1,3 @@
-use serialize::json;
-
 use server::header;
 use server::mime;
 use server::status;
@@ -8,6 +6,8 @@ use typemap;
 pub use iron::response::WriteBody;
 pub use iron::response::ResponseBody;
 
+use super::super::json::{JsonValue};
+
 pub struct Response {
     pub status: status::StatusCode,
     pub headers: header::Headers,
@@ -46,7 +46,7 @@ impl Response {
         ));
     }
 
-    pub fn from_json(status: status::StatusCode, body: &json::Json) -> Response {
+    pub fn from_json(status: status::StatusCode, body: &JsonValue) -> Response {
         let mut response = Response::new(status);
         response.set_json_content_type();
         response.replace_body(Box::new(body.to_string()));
diff --git a/src/backend/simple_request.rs b/src/backend/simple_request.rs
index abeb97e6..3b112089 100644
--- a/src/backend/simple_request.rs
+++ b/src/backend/simple_request.rs
@@ -112,7 +112,7 @@ impl fmt::Debug for SimpleRequest {
         try!(writeln!(f, "  url: {}", self.url));
         try!(writeln!(f, "  method: {}", self.method()));
         try!(writeln!(f, "  path: {:?}", self.url.path()));
-        try!(writeln!(f, "  query: {:?}", self.url.query));
+        try!(writeln!(f, "  query: {:?}", self.url.query()));
         try!(writeln!(f, "  remote_addr: {}", self.remote_addr()));
         Ok(())
     }
diff --git a/src/batteries/cookie.rs b/src/batteries/cookie.rs
index b66b9e7d..aef55377 100644
--- a/src/batteries/cookie.rs
+++ b/src/batteries/cookie.rs
@@ -1,6 +1,6 @@
 use iron;
 
-use cookie;
+pub use hyper::header::{CookiePair as Cookie, CookieJar};
 use backend::{self, Request};
 use server::header;
 use ::{Extensible};
@@ -8,23 +8,23 @@ use ::{Extensible};
 struct CookieJarKey;
 
 impl ::typemap::Key for CookieJarKey {
-    type Value = cookie::CookieJar<'static>;
+    type Value = CookieJar<'static>;
 }
 
 pub trait CookieExt {
-    fn find_cookie_jar(&mut self) -> Option<&mut cookie::CookieJar<'static>>;
-    fn store_cookie_jar(&mut self, jar: cookie::CookieJar<'static>);
-    fn cookies<'a>(&'a mut self) -> &'a mut cookie::CookieJar<'static> {
+    fn find_cookie_jar(&mut self) -> Option<&mut CookieJar<'static>>;
+    fn store_cookie_jar(&mut self, jar: CookieJar<'static>);
+    fn cookies<'a>(&'a mut self) -> &'a mut CookieJar<'static> {
         self.find_cookie_jar().unwrap()
     }
 }
 
 impl<'r> CookieExt for (backend::Request + 'r) {
-    fn find_cookie_jar<'a>(&'a mut self) -> Option<&'a mut cookie::CookieJar<'static>> {
+    fn find_cookie_jar<'a>(&'a mut self) -> Option<&'a mut CookieJar<'static>> {
         self.ext_mut().get_mut::<CookieJarKey>()
     }
 
-    fn store_cookie_jar(&mut self, jar: cookie::CookieJar<'static>) {
+    fn store_cookie_jar(&mut self, jar: CookieJar<'static>) {
         self.ext_mut().insert::<CookieJarKey>(jar);
     }
 }
@@ -38,7 +38,7 @@ impl iron::BeforeMiddleware for CookieDecodeMiddleware {
         let token = &self.secret_token;
         let jar = req.headers().get::<header::Cookie>()
             .map(|cookies| cookies.to_cookie_jar(token))
-            .unwrap_or_else(|| cookie::CookieJar::new(token));
+            .unwrap_or_else(|| CookieJar::new(token));
 
         req.ext_mut().insert::<CookieJarKey>(jar);
         Ok(())
diff --git a/src/batteries/swagger.rs b/src/batteries/swagger.rs
index 64532bda..f2985baa 100644
--- a/src/batteries/swagger.rs
+++ b/src/batteries/swagger.rs
@@ -1,8 +1,9 @@
 use std::ascii::AsciiExt;
 use valico::json_dsl;
 use std::collections;
-use serialize::json::{self, ToJson};
-use jsonway::{self, MutableJson};
+use jsonway::{self};
+
+use json::{self, JsonValue, ToJson};
 use framework::{self, Nesting};
 use server::mime;
 use server::header;
@@ -180,8 +181,8 @@ struct Param {
     pub ext: ParamExt
 }
 
-impl json::ToJson for Param {
-    fn to_json(&self) -> json::Json {
+impl ToJson for Param {
+    fn to_json(&self) -> JsonValue {
         jsonway::object(|param| {
             param.set("name", self.name.clone());
             param.set("in", self.place.to_string());
@@ -205,7 +206,7 @@ impl json::ToJson for Param {
 
 pub struct SwaggerSpecKey;
 impl ::typemap::Key for SwaggerSpecKey {
-    type Value = json::Json;
+    type Value = JsonValue;
 }
 
 pub fn enable(app: &mut framework::Application, spec: Spec) {
@@ -215,7 +216,7 @@ pub fn enable(app: &mut framework::Application, spec: Spec) {
 
 #[allow(unused_variables)]
 /// Build the basic Swagger 2.0 object
-pub fn build_spec(app: &framework::Application, spec: Spec) -> json::Json {
+pub fn build_spec(app: &framework::Application, spec: Spec) -> JsonValue {
     jsonway::object(|json| {
         // Required. Specifies the Swagger Specification version being used.
         // It can be used by the Swagger UI and other clients to interpret the API listing.
@@ -490,7 +491,7 @@ fn fill_paths<'a>(mut context: WalkContext<'a>, paths: &mut jsonway::ObjectBuild
             };
 
             if !exists {
-                paths.object(&path, |path_item| {
+                paths.object(path.to_string(), |path_item| {
                     path_item.set(method.clone(), definition.to_json());
                     path_item.array("parameters", |parameters| {
                         for param in context.params.iter() {
@@ -505,7 +506,7 @@ fn fill_paths<'a>(mut context: WalkContext<'a>, paths: &mut jsonway::ObjectBuild
 
 #[allow(unused_variables)]
 /// Creates Endpoint definition according to Swagger 2.0 specification
-fn build_endpoint_definition(endpoint: &framework::Endpoint, context: &mut WalkContext) -> json::Json {
+fn build_endpoint_definition(endpoint: &framework::Endpoint, context: &mut WalkContext) -> JsonValue {
     jsonway::object(|def| {
         // A list of tags for API documentation control. Tags can be used for logical grouping
         // of operations by resources or any other qualifier.
diff --git a/src/framework/api.rs b/src/framework/api.rs
index 64af0f33..6517017d 100644
--- a/src/framework/api.rs
+++ b/src/framework/api.rs
@@ -1,14 +1,12 @@
-use serialize::json;
-
-use backend;
-use server::mime;
-use server::header;
-use errors;
- 
 use framework;
 use framework::nesting::{self, Nesting, Node};
 use framework::media;
 use framework::path;
+use backend;
+use errors;
+use server::mime;
+use server::header;
+use json::{JsonValue};
 
 #[allow(dead_code)]
 #[allow(missing_copy_implementations)]
@@ -116,7 +114,7 @@ impl_nesting!(Api);
 impl framework::ApiHandler for Api {
     fn api_call<'a, 'r>(&'a self,
         rest_path: &str,
-        params: &mut json::Json,
+        params: &mut JsonValue,
         req: &'r mut (backend::Request + 'r),
         info: &mut framework::CallInfo<'a>) -> backend::HandleResult<backend::Response> {
 
@@ -150,7 +148,7 @@ impl framework::ApiHandler for Api {
                 },
                 &Versioning::Param(ref param_name) => {
                     match params.find(param_name) {
-                        Some(obj) if obj.is_string() && obj.as_string().unwrap() == &version[..] => (),
+                        Some(obj) if obj.is_string() && obj.as_str().unwrap() == &version[..] => (),
                         _ => return Err(error_response!(errors::NotMatch))
                     }
                 },
diff --git a/src/framework/api_handler.rs b/src/framework/api_handler.rs
index 3cc3bc5c..80fe544d 100644
--- a/src/framework/api_handler.rs
+++ b/src/framework/api_handler.rs
@@ -2,12 +2,13 @@ use typeable::Typeable;
 use traitobject;
 use std::any::TypeId;
 use std::mem;
-use serialize::json;
+
 use backend;
-use super::CallInfo;
+use super::{CallInfo};
+use json::{JsonValue};
 
 pub trait ApiHandler: Typeable {
-    fn api_call<'a, 'b>(&'a self, &str, &mut json::Json, &'b mut (backend::Request + 'b), &mut CallInfo<'a>) -> backend::HandleResult<backend::Response>;
+    fn api_call<'a, 'b>(&'a self, &str, &mut JsonValue, &'b mut (backend::Request + 'b), &mut CallInfo<'a>) -> backend::HandleResult<backend::Response>;
 }
 
 impl ApiHandler {
diff --git a/src/framework/app.rs b/src/framework/app.rs
index fa907b25..124f5dfe 100644
--- a/src/framework/app.rs
+++ b/src/framework/app.rs
@@ -1,14 +1,13 @@
 use std::collections;
-use serialize::json;
 use typemap;
 use queryst;
-use valico::MutableJson;
 
 use super::{ApiHandler};
-use super::api;
-use super::super::backend;
-use super::super::errors;
-use super::super::server::status;
+use framework::api;
+use backend;
+use errors;
+use server::status;
+use json::{JsonValue};
 
 pub struct Application {
     pub ext: typemap::TypeMap,
@@ -27,7 +26,7 @@ impl Application {
     }
 
     fn call_internal<'a>(&self, req: &'a mut (backend::Request + 'a)) -> backend::HandleResult<backend::Response> {
-        let mut params = json::Json::Object(collections::BTreeMap::new());
+        let mut params = JsonValue::Object(collections::BTreeMap::new());
         let parse_result = parse_request(req, &mut params);
 
         parse_result.and_then(|_| {
@@ -76,7 +75,7 @@ impl super::super::Extensible for Application {
     fn ext_mut(&mut self) -> &mut ::typemap::TypeMap { &mut self.ext }
 }
 
-fn parse_query(query_str: &str, params: &mut json::Json) -> backend::HandleSuccessResult {
+fn parse_query(query_str: &str, params: &mut JsonValue) -> backend::HandleSuccessResult {
     let maybe_query_params = queryst::parse(query_str);
     match maybe_query_params {
         Ok(query_params) => {
@@ -95,12 +94,12 @@ fn parse_query(query_str: &str, params: &mut json::Json) -> backend::HandleSucce
     Ok(())
 }
 
-fn parse_json_body(req: &mut backend::Request, params: &mut json::Json) -> backend::HandleSuccessResult {
+fn parse_json_body(req: &mut backend::Request, params: &mut JsonValue) -> backend::HandleSuccessResult {
     let maybe_body = try!(req.read_to_end().map_err(|err| error_response_boxed!(err)))
         .unwrap_or(String::new());
 
     if maybe_body.len() > 0 {
-      let maybe_json_body = maybe_body.parse::<json::Json>();
+      let maybe_json_body = maybe_body.parse::<JsonValue>();
         match maybe_json_body {
             Ok(json_body) => {
                 let params = params.as_object_mut().expect("Params must be object");
@@ -121,7 +120,7 @@ fn parse_json_body(req: &mut backend::Request, params: &mut json::Json) -> backe
     Ok(())
 }
 
-fn parse_urlencoded_body(req: &mut backend::Request, params: &mut json::Json) -> backend::HandleSuccessResult {
+fn parse_urlencoded_body(req: &mut backend::Request, params: &mut JsonValue) -> backend::HandleSuccessResult {
     let maybe_body = try!(req.read_to_end().map_err(|err| error_response_boxed!(err)))
         .unwrap_or(String::new());
 
@@ -147,7 +146,7 @@ fn parse_urlencoded_body(req: &mut backend::Request, params: &mut json::Json) ->
     Ok(())
 }
 
-fn parse_request(req: &mut backend::Request, params: &mut json::Json) -> backend::HandleSuccessResult {
+fn parse_request(req: &mut backend::Request, params: &mut JsonValue) -> backend::HandleSuccessResult {
     // extend params with query-string params if any
     if req.url().query().is_some() {
         try!(parse_query(&req.url().query().as_ref().unwrap(), params));
diff --git a/src/framework/client.rs b/src/framework/client.rs
index f3175663..7f5f3050 100644
--- a/src/framework/client.rs
+++ b/src/framework/client.rs
@@ -1,4 +1,3 @@
-use serialize::json;
 use typemap;
 use std::env;
 use std::path::Path;
@@ -9,9 +8,8 @@ use errors::{self, Error};
 use framework::app;
 use framework::endpoint;
 use framework::media;
-use server::status;
-use server::mime;
-use server::header;
+use server::{status, mime, header};
+use json::{JsonValue};
 
 pub struct Client<'a> {
     pub app: &'a app::Application,
@@ -90,7 +88,7 @@ impl<'a> Client<'a> {
         Err(error_response!(error))
     }
 
-    pub fn json(mut self, result: &json::Json) -> ClientResult<'a> {
+    pub fn json(mut self, result: &JsonValue) -> ClientResult<'a> {
         self.set_json_content_type();
         self.response.replace_body(Box::new(result.to_string()));
 
@@ -110,14 +108,14 @@ impl<'a> Client<'a> {
                 return Err(error_response!(errors::File(err)));
             }
         };
-        
+
         let file = match File::open(absolute_path) {
             Ok(file) => file,
             Err(err) => {
                 return Err(error_response!(errors::File(err)));
             }
         };
-        
+
         self.response.replace_body(Box::new(file));
         Ok(self)
     }
diff --git a/src/framework/endpoint.rs b/src/framework/endpoint.rs
index d0a6b3b3..bdbd6d81 100644
--- a/src/framework/endpoint.rs
+++ b/src/framework/endpoint.rs
@@ -1,18 +1,15 @@
-use serialize::json;
-
 use valico::json_dsl;
 use valico::json_schema;
 
-use server::method;
-use server::mime;
+use server::{method, mime};
 use backend;
 use errors;
+use json::{JsonValue};
+use batteries::schemes;
 use framework;
 use framework::path;
 
-use batteries::schemes;
-
-pub type EndpointHandler = Box<for<'a> Fn(framework::Client<'a>, &json::Json) -> backend::HandleResult<framework::Client<'a>> + 'static + Sync>;
+pub type EndpointHandler = Box<for<'a> Fn(framework::Client<'a>, &JsonValue) -> backend::HandleResult<framework::Client<'a>> + 'static + Sync>;
 
 #[allow(missing_copy_implementations)]
 pub enum EndpointHandlerPresent {
@@ -78,7 +75,7 @@ impl Endpoint {
     }
 
     pub fn handle<F: 'static>(&mut self, handler: F) -> EndpointHandlerPresent
-    where F: for<'a> Fn(framework::Client<'a>, &json::Json) -> backend::HandleResult<framework::Client<'a>> + Sync+Send {
+    where F: for<'a> Fn(framework::Client<'a>, &JsonValue) -> backend::HandleResult<framework::Client<'a>> + Sync+Send {
         self.handler = Some(Box::new(handler));
         EndpointHandlerPresent::HandlerPresent
     }
@@ -88,7 +85,7 @@ impl Endpoint {
         EndpointHandlerPresent::HandlerPresent
     }
 
-    fn validate(&self, params: &mut json::Json, scope: Option<&json_schema::Scope>) -> backend::HandleResult<()> {
+    fn validate(&self, params: &mut JsonValue, scope: Option<&json_schema::Scope>) -> backend::HandleResult<()> {
         // Validate namespace params with valico
         if self.coercer.is_some() {
             // validate and coerce params
@@ -108,7 +105,7 @@ impl Endpoint {
     }
 
     pub fn call_endpoint<'a>(&self,
-        params: &mut json::Json,
+        params: &mut JsonValue,
         req: &'a mut (backend::Request + 'a),
         info: &mut framework::CallInfo) -> backend::HandleResult<backend::Response> {
 
@@ -141,7 +138,7 @@ impl Endpoint {
     fn call_callbacks(
         cbs: &Vec<framework::Callback>,
         client: &mut framework::Client,
-        params: &mut json::Json) -> backend::HandleSuccessResult {
+        params: &mut JsonValue) -> backend::HandleSuccessResult {
 
         for cb in cbs.iter() {
             try!(cb(client, params));
@@ -155,7 +152,7 @@ impl Endpoint {
 impl framework::ApiHandler for Endpoint {
     fn api_call<'r>(&self,
         rest_path: &str,
-        params: &mut json::Json,
+        params: &mut JsonValue,
         req: &'r mut (backend::Request + 'r),
         info: &mut framework::CallInfo) -> backend::HandleResult<backend::Response> {
 
diff --git a/src/framework/media.rs b/src/framework/media.rs
index baa394ea..3dda19b2 100644
--- a/src/framework/media.rs
+++ b/src/framework/media.rs
@@ -1,4 +1,3 @@
-
 use regex;
 use server::mime;
 
diff --git a/src/framework/mod.rs b/src/framework/mod.rs
index 25917bf8..f54bd903 100644
--- a/src/framework/mod.rs
+++ b/src/framework/mod.rs
@@ -1,7 +1,6 @@
-use serialize::json;
-
 use backend;
 use errors;
+use json::{JsonValue};
 
 pub use self::api_handler::{ApiHandler, ApiHandlers};
 pub use self::app::{Application};
@@ -30,7 +29,7 @@ pub struct CallInfo<'a> {
     pub app: &'a app::Application
 }
 
-pub type Callback = Box<for<'a> Fn(&'a mut client::Client, &json::Json) -> backend::HandleSuccessResult + 'static + Sync + Send>;
+pub type Callback = Box<for<'a> Fn(&'a mut client::Client, &JsonValue) -> backend::HandleSuccessResult + 'static + Sync + Send>;
 pub type Callbacks = Vec<Callback>;
 
 pub type ErrorFormatter = Box<Fn(&errors::Error, &media::Media) -> Option<backend::Response> + 'static + Sync + Send>;
diff --git a/src/framework/namespace.rs b/src/framework/namespace.rs
index 78df89e8..ef04c14b 100644
--- a/src/framework/namespace.rs
+++ b/src/framework/namespace.rs
@@ -1,13 +1,12 @@
-use serialize::json;
 use valico::json_dsl;
 use valico::json_schema;
 
 use backend;
 use errors;
-
+use json::{JsonValue};
+use framework::nesting::{self, Nesting, Node};
 use framework;
 use framework::path;
-use framework::nesting::{self, Nesting, Node};
 
 use batteries::schemes;
 
@@ -48,7 +47,7 @@ impl Namespace {
         return namespace;
     }
 
-    fn validate(&self, params: &mut json::Json, scope: Option<&json_schema::Scope>) -> backend::HandleResult<()> {
+    fn validate(&self, params: &mut JsonValue, scope: Option<&json_schema::Scope>) -> backend::HandleResult<()> {
         // Validate namespace params with valico
         if self.coercer.is_some() {
             // validate and coerce params
@@ -70,8 +69,13 @@ impl Namespace {
 }
 
 impl framework::ApiHandler for Namespace {
-    fn api_call<'a, 'r>(&'a self, rest_path: &str, params: &mut json::Json, req: &'r mut (backend::Request + 'r),
-                    info: &mut framework::CallInfo<'a>) -> backend::HandleResult<backend::Response> {
+    fn api_call<'a, 'r>(
+        &'a self,
+        rest_path: &str,
+        params: &mut JsonValue,
+        req: &'r mut (backend::Request + 'r),
+        info: &mut framework::CallInfo<'a>
+    ) -> backend::HandleResult<backend::Response> {
 
         let rest_path: &str = match self.path.is_match(rest_path) {
             Some(captures) =>  {
diff --git a/src/framework/nesting.rs b/src/framework/nesting.rs
index 81c2fc4e..104eee06 100644
--- a/src/framework/nesting.rs
+++ b/src/framework/nesting.rs
@@ -1,13 +1,11 @@
-use serialize::json;
-
-use backend;
-use server::method;
-use errors;
-
 use framework;
 use framework::namespace;
 use framework::endpoint;
 use framework::client;
+use json::{JsonValue};
+use backend;
+use server::method;
+use errors;
 
 pub trait Node {
     fn get_handlers<'a>(&'a self) -> &'a framework::ApiHandlers;
@@ -111,24 +109,24 @@ pub trait Nesting: Node {
         self.mount(endpoint::Endpoint::build(method::Method::Head, path, builder));
     }
 
-    fn before<F: 'static>(&mut self, callback: F) where F: for<'a> Fn(&'a mut client::Client, &json::Json)
+    fn before<F: 'static>(&mut self, callback: F) where F: for<'a> Fn(&'a mut client::Client, &JsonValue)
     -> backend::HandleSuccessResult + Send+Sync {
         self.get_before_mut().push(Box::new(callback));
     }
-    fn before_validation<F: 'static>(&mut self, callback: F) where F: for<'a> Fn(&'a mut client::Client, &json::Json)
+    fn before_validation<F: 'static>(&mut self, callback: F) where F: for<'a> Fn(&'a mut client::Client, &JsonValue)
     -> backend::HandleSuccessResult + Send+Sync {
         self.get_before_validation_mut().push(Box::new(callback));
     }
-    fn after<F: 'static>(&mut self, callback: F) where F: for<'a> Fn(&'a mut client::Client, &json::Json)
+    fn after<F: 'static>(&mut self, callback: F) where F: for<'a> Fn(&'a mut client::Client, &JsonValue)
     -> backend::HandleSuccessResult + Send+Sync {
         self.get_after_mut().push(Box::new(callback));
     }
-    fn after_validation<F: 'static>(&mut self, callback: F) where F: for<'a> Fn(&'a mut client::Client, &json::Json)
+    fn after_validation<F: 'static>(&mut self, callback: F) where F: for<'a> Fn(&'a mut client::Client, &JsonValue)
     -> backend::HandleSuccessResult + Send+Sync {
         self.get_after_validation_mut().push(Box::new(callback));
     }
 
-    fn call_handlers<'a, 'r>(&'a self, rest_path: &str, params: &mut json::Json, req: &'r mut (backend::Request + 'r),
+    fn call_handlers<'a, 'r>(&'a self, rest_path: &str, params: &mut JsonValue, req: &'r mut (backend::Request + 'r),
                          info: &mut framework::CallInfo<'a>) -> backend::HandleResult<backend::Response> {
 
         for handler in self.get_handlers().iter() {
diff --git a/src/framework/path.rs b/src/framework/path.rs
index 00abf4b8..1185eed7 100644
--- a/src/framework/path.rs
+++ b/src/framework/path.rs
@@ -1,9 +1,8 @@
 extern crate url;
 
-use url::percent_encoding::lossy_utf8_percent_decode;
-use valico::MutableJson;
-use serialize::json::{self, ToJson};
+use url::percent_encoding::percent_decode;
 use regex;
+use json::{JsonValue, ToJson};
 
 lazy_static! {
     pub static ref MATCHER: regex::Regex = regex::Regex::new(r":([a-z][a-z_]*)").unwrap();
@@ -25,10 +24,14 @@ pub fn normalize<'a>(path: &'a str) -> &'a str {
 
 impl Path {
 
-    pub fn apply_captures(&self, params: &mut json::Json, captures: regex::Captures) {
+    pub fn apply_captures(&self, params: &mut JsonValue, captures: regex::Captures) {
         let obj = params.as_object_mut().expect("Params must be object");
         for param in self.params.iter() {
-            obj.insert(param.clone(), lossy_utf8_percent_decode(captures.name(&param).unwrap_or("").as_bytes()).to_json());
+            obj.insert(
+                param.clone(), 
+                percent_decode(
+                    captures.name(&param).unwrap_or("").as_bytes()
+                ).decode_utf8_lossy().to_string().to_json());
         }
     }
 
diff --git a/src/json.rs b/src/json.rs
new file mode 100644
index 00000000..86942f4f
--- /dev/null
+++ b/src/json.rs
@@ -0,0 +1,6 @@
+pub use serde_json::{Value as JsonValue, to_value, to_string};
+pub use serde_json::value::{ToJson};
+use std::collections::{BTreeMap};
+
+pub type Object = BTreeMap<String, JsonValue>;
+pub type Array = Vec<JsonValue>;
diff --git a/src/lib.rs b/src/lib.rs
index 7631bfd5..ad5df965 100644
--- a/src/lib.rs
+++ b/src/lib.rs
@@ -4,21 +4,19 @@
 #![deny(bad_style)]
 
 extern crate regex;
+extern crate serde;
+extern crate serde_json;
 extern crate hyper;
-extern crate rustc_serialize as serialize;
 extern crate url;
 extern crate error;
 extern crate cookie;
-
 extern crate iron;
 extern crate typemap;
 extern crate plugin;
 extern crate bodyparser;
-
 extern crate valico;
 extern crate queryst;
 extern crate jsonway;
-
 extern crate typeable;
 extern crate traitobject;
 
@@ -28,6 +26,7 @@ extern crate lazy_static;
 #[macro_use]
 extern crate log;
 
+pub use json::{JsonValue};
 pub use backend::{Request, SimpleRequest, Response, Handler, HandleResult, HandleSuccessResult, ResponseBody};
 pub use errors::{ErrorResponse};
 pub use framework::{
@@ -57,3 +56,4 @@ macro_rules! impl_extensible {
 pub mod server;
 pub mod framework;
 pub mod batteries;
+pub mod json;
diff --git a/src/server.rs b/src/server.rs
index dce82a59..4917ecb9 100644
--- a/src/server.rs
+++ b/src/server.rs
@@ -1,4 +1,3 @@
-
 pub use hyper::status;
 pub use hyper::mime;
 pub use hyper::header;


Test patch:
diff --git a/tests/callbacks.rs b/tests/callbacks.rs
index 8dc26576..f1599b73 100644
--- a/tests/callbacks.rs
+++ b/tests/callbacks.rs
@@ -45,7 +45,7 @@ fn it_invokes_callbacks() {
             admin_ns.after_validation(|_client, params| {
                 match params.find(&"token".to_string()) {
                     // We can.unwrap() safely because token in validated already
-                    Some(token) => if token.as_string().unwrap() == "password1" { return Ok(()) },
+                    Some(token) => if token.as_str().unwrap() == "password1" { return Ok(()) },
                     None => ()
                 }
 
diff --git a/tests/params.rs b/tests/params.rs
index 51d19c7d..3071f8a4 100644
--- a/tests/params.rs
+++ b/tests/params.rs
@@ -18,7 +18,7 @@ fn it_urldecodes_path_params() {
             });
 
             endpoint.handle(|client, params| {
-                client.text(format!("{}", params.find("message_id").and_then(|obj| { obj.as_string() }).unwrap()))
+                client.text(format!("{}", params.find("message_id").and_then(|obj| { obj.as_str() }).unwrap()))
             })
         })
     });
@@ -43,7 +43,7 @@ fn it_urldecodes_query_params() {
             });
 
             endpoint.handle(|client, params| {
-                client.text(format!("{}", params.find("message_id").and_then(|obj| { obj.as_string() }).unwrap()))
+                client.text(format!("{}", params.find("message_id").and_then(|obj| { obj.as_str() }).unwrap()))
             })
         })
     });
diff --git a/tests/redirect.rs b/tests/redirect.rs
index fe7f1007..5eccae87 100644
--- a/tests/redirect.rs
+++ b/tests/redirect.rs
@@ -9,7 +9,7 @@ fn it_allows_redirect() {
         api.prefix("api");
         api.post("redirect_me/:href", |endpoint| {
             endpoint.handle(|client, params| {
-                client.redirect(params.find(&"href".to_string()).unwrap().as_string().unwrap())
+                client.redirect(params.find(&"href".to_string()).unwrap().as_str().unwrap())
             })
         });
     });
@@ -28,7 +28,7 @@ fn it_allows_permanent_redirect() {
         api.prefix("api");
         api.post("redirect_me/:href", |endpoint| {
             endpoint.handle(|client, params| {
-                client.permanent_redirect(params.find(&"href".to_string()).unwrap().as_string().unwrap())
+                client.permanent_redirect(params.find(&"href".to_string()).unwrap().as_str().unwrap())
             })
         });
     });
diff --git a/tests/serializers.rs b/tests/serializers.rs
index bc11be67..26bc5eab 100644
--- a/tests/serializers.rs
+++ b/tests/serializers.rs
@@ -1,4 +1,4 @@
-use serialize::json;
+use serde_json::value::{Value};
 
 use jsonway;
 
@@ -32,7 +32,7 @@ fn it_serializes_json_properly() {
     }
 
     let raw_body = resp_body!(response);
-    let body: json::Json = raw_body.parse().unwrap();
+    let body: Value = raw_body.parse().unwrap();
 
     assert!(body.find("uptime").is_some());
     assert!(body.find("echo_params").is_some());
diff --git a/tests/tests.rs b/tests/tests.rs
index 22a7cc2a..03c18e72 100644
--- a/tests/tests.rs
+++ b/tests/tests.rs
@@ -4,10 +4,11 @@
 #[macro_use]
 extern crate rustless;
 extern crate hyper;
-extern crate rustc_serialize as serialize;
 extern crate url;
 extern crate valico;
 extern crate jsonway;
+extern crate serde;
+extern crate serde_json;
 
 #[macro_export]
 macro_rules! sr {