获取指定节点元素个数 @param jsonPath @return
(String jsonPath)
| 150 | * @return |
| 151 | */ |
| 152 | public int length(String jsonPath) { |
| 153 | Object object = get(jsonPath); |
| 154 | if (object instanceof JSONObject) |
| 155 | return ((JSONObject) object).length(); |
| 156 | if (object instanceof JSONArray) |
| 157 | return ((JSONArray) object).length(); |
| 158 | return 0; |
| 159 | } |
| 160 | |
| 161 | /** |
| 162 | * 转换为json字符串 |
no test coverage detected