JOSNFilter作为新增的,针对Fastjson2的过滤数据抽象工具类,主要职能在于对json数据的进行过滤黑白名单。
一、主要过滤方法
// F.1 针对JSONObject的过滤方法
public static void jsonFilter(JSONObject jsonObj, JSONFilter filter){}
// F.2 针对JSONArray的黑白名单-过滤方法
public static void jsonFilter(JSONArray jsonArray, JSONFilter filter) {}
过滤方法体中,主要使用递归的方式,对一个json进行层层过滤,从而达到对黑白名单的彻底果过滤。