| Package | Description |
|---|---|
| org.dromara.hutool.json |
JSON(JavaScript Object Notation JavaScript对象表示法)封装,包含以下组件:
JSONObject:使用键值对表示的数据类型,使用"{}"包围
JSONArray:使用列表表示的数据类型,使用"[]"包围
JSON封装主要包括JSON表示和JSON转换:
<--JSONConverter-- <---JSONParser----
Java对象 <=================> JSON对象 <=================> JSON字符串
------mapper-----> ---JSONWriter---->
当然,为了高效转换,如果没有自定义需求,Java对象可以不通过JSON对象与JSON字符串转换:
JSONTokener:JSON字符串底层解析器,通过Stream方式读取JSON字符串并对不同字段自定义处理。 |
| Modifier and Type | Field and Description |
|---|---|
static JSONStrFormatter |
JSONStrFormatter.INSTANCE
默认实例
|
| Modifier and Type | Method and Description |
|---|---|
JSONStrFormatter |
JSONStrFormatter.setIndentFactor(int indentFactor)
设置缩进因子,即每个缩进空格数
|
JSONStrFormatter |
JSONStrFormatter.setNewLineChars(CharSequence newLineChars)
设置换行符
|
Copyright © 2024. All rights reserved.