Fixed the "Undefined index: json_route" problem and moved includes to inside json_api_loaded().

See: 
- https://gsoc.trac.wordpress.org/ticket/336
- https://gsoc.trac.wordpress.org/ticket/337