開(kāi)發(fā)中需要用到j(luò)son,在瀏覽器顯示的json非常亂,難以理解。有沒(méi)有讓人一目了然的工具,讓json看起來(lái)非常直觀呢,json-handle隨之而出,包含火狐和chrome兩種插件,官方地址:http://jsonhandle.sinaapp.com/
Chrome常用的插件 JSON-handle ,用過(guò)的都知道。
對(duì)于經(jīng)常在瀏覽器調(diào)試json的你,json-handle是個(gè)不二的選擇.最近在做接口加密,所有的數(shù)據(jù)( request 和 response )都是加密數(shù)據(jù),無(wú)法溝通 fildder 或者 Charles 抓包查看。那么自己做一個(gè)查看 json` 格式的View`:支持動(dòng)態(tài)的放大,縮小,支持所有數(shù)據(jù)格式~!

效果圖:

GitHub地址: JsonHandleView
依賴
implementation 'com.tzx.json:jsonhandleview:1.0.0'
使用
<?xml version="1.0" encoding="utf-8"?><FrameLayout xmlns:android="http://schemas.android.com/apk/res/android" android:layout_width="match_parent" android:layout_height="match_parent" android:fillViewport="true" android:orientation="vertical"> <com.dandan.jsonhandleview.library.JsonViewLayout android:id="@+id/jsonView" android:layout_width="match_parent" android:layout_height="wrap_content" /></FrameLayout>
JsonViewLayout jsonViewLayout = findViewById(R.id.jsonView);jsonViewLayout.bindJson("your json strings." || JSONObject || JSONArray);自定義風(fēng)格
// ColorjsonViewLayout.setKeyColor()jsonViewLayout.setObjectKeyColor()jsonViewLayout.setValueTextColor()jsonViewLayout.setValueNumberColor()jsonViewLayout.setValueNullColor()jsonViewLayout.setValueBooleanColor()jsonViewLayout.setArrayLengthColor()// TextSizejsonViewLayout.setTextSize()
文章到這里就全部講述完啦,若有其他需要交流的可以留言哦~!~!希望對(duì)大家的學(xué)習(xí)有所幫助,也希望大家多多支持武林網(wǎng)。
新聞熱點(diǎn)
疑難解答
圖片精選