litesuits / android-lite-http

LiteHttp is a simple, intelligent and flexible HTTP framework for Android. With LiteHttp you can make HTTP request with only one line of code! It could convert a java model to the parameter and rander the response JSON as a java model intelligently.
http://litesuits.com?form=ghttp
Apache License 2.0
830 stars 347 forks source link

如果想把json解析这块用fastjson来做该怎么操作? #2

Closed jbasttdi closed 9 years ago

jbasttdi commented 9 years ago

我们项目中json解析用了fastjson这个lib库,解析json的速度是挺快的,如果想把你这个框架中的json解析换成fastjson来做,不知该怎么操作。谢谢了!!

litesuits commented 9 years ago

LiteHttp对外和对内都抽象出了Json处理(主要是json和对象互转)方法,仅需要替换实现即可。 具体方法:

  1. 写一个简单拓展类:FastjsonImpl替换GsonImpl
  2. Json.get()方法中返回new FastjsonImpl() 即可完成全局json解析框架的替换。