Package io.rong.common

## Class JSONUtils

- All Implemented Interfaces:

      public class JSONUtils

- - ### Nested Class Summary

    Nested Classes
    Modifier and Type | Class | Description
    --- | --- | ---

  - ### Field Summary

    Fields
    Modifier and Type | Field | Description
    --- | --- | ---

  - ### Constructor Summary

    Constructors
    Constructor | Description
    --- | ---
    `JSONUtils()` |

  - ### Enum Constant Summary

    Enum Constants
    Enum Constant | Description
    --- | ---

  - ### Method Summary

    Modifier and Type | Method | Description
    --- | --- | ---
    `static HashMap<String, MessageExpansion>` | `jsonToExpansionEx(String originJson)` | 将 json 字符串 转换成 `HashMap<String, MessageExpansion>` 对象 MessageExpansion
    `static HashMap<String, String>` | `expansionExToMap(Map<String, MessageExpansion> map)` | 将 `Map<String, MessageExpansion>` 转换成 `HashMap<String, String>`MessageExpansion
    `static String` | `mapTsCombineJson(Map<String, String> map, long ts)` | 将用户设置的 Map 集合和 时间戳组装成 JSON 字符串
    `static String` | `exMapToJson(HashMap<String, MessageExpansion> hashMap)` | 将 `HashMap<String, MessageExpansion>` 对象解析成 json 字符串
    `static List<Object>` | `removeKeysInExpansionEx(List<String> arrayList, HashMap<String, MessageExpansion> hashMap)` | 删除指定的 keys
    `static List<Object>` | `removeKeysTSInExpansionEx(long time, List<String> arrayList, HashMap<String, MessageExpansion> hashMap)` | 删除指定的 keys，带时间戳比对
    `static HashMap<String, String>` | `expansionExJSONToMap(String jsonString)` | 将 JSON 字符串转换成 `HashMap<String, String>`
    `static String` | `hashMapToJson(Map<String, String> map)` | 将 `Map<String, String> map` 转换成 json 字符串 格式："key1":{ "v":"value1" }
    `static List<String>` | `mergeJson(String expansionJsonSet, String expansionExisted)` | 将两个带时间戳的 json 串合并

    - ### Methods inherited from class java.lang.Object

      `clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

- - ### Constructor Detail

    - #### JSONUtils

          JSONUtils()

  - ### Method Detail

    - #### jsonToExpansionEx

           static HashMap<String, MessageExpansion> jsonToExpansionEx(String originJson)

      将 json 字符串 转换成 `HashMap<String, MessageExpansion>` 对象 MessageExpansion

      Parameters:
        `originJson` - 原始的 json 字符串
      Returns:

        `HashMap<String, MessageExpansion>`MessageExpansion

    - #### expansionExToMap

           static HashMap<String, String> expansionExToMap(Map<String, MessageExpansion> map)

      将 `Map<String, MessageExpansion>` 转换成 `HashMap<String, String>`MessageExpansion

      Parameters:
        `map` - `Map<String, MessageExpansion>`
      Returns:

        `HashMap<String, String>`

    - #### mapTsCombineJson

           static String mapTsCombineJson(Map<String, String> map, long ts)

      将用户设置的 Map 集合和 时间戳组装成 JSON 字符串

      Parameters:
        `map` - Map
        `ts` - 时间戳
      Returns:

        字符串

    - #### exMapToJson

           static String exMapToJson(HashMap<String, MessageExpansion> hashMap)

      将 `HashMap<String, MessageExpansion>` 对象解析成 json 字符串

      Parameters:
        `hashMap` - `HashMap<String, MessageExpansion>`
      Returns:

        字符串

    - #### removeKeysInExpansionEx

           static List<Object> removeKeysInExpansionEx(List<String> arrayList, HashMap<String, MessageExpansion> hashMap)

      删除指定的 keys

      Parameters:
        `arrayList` - 要删除的 key 集合
        `hashMap` - `HashMap<String, MessageExpansion>`
      Returns:

        删除后全量和增量数据

    - #### removeKeysTSInExpansionEx

           static List<Object> removeKeysTSInExpansionEx(long time, List<String> arrayList, HashMap<String, MessageExpansion> hashMap)

      删除指定的 keys，带时间戳比对

      Parameters:
        `arrayList` - 要删除的 key 集合
        `hashMap` - `HashMap<String, MessageExpansion>`
      Returns:

        删除后全量和增量数据

    - #### expansionExJSONToMap

           static HashMap<String, String> expansionExJSONToMap(String jsonString)

      将 JSON 字符串转换成 `HashMap<String, String>`

      Parameters:
        `jsonString` - json 字符串
      Returns:

        `HashMap<String, String>`

    - #### hashMapToJson

           static String hashMapToJson(Map<String, String> map)

      将 `Map<String, String> map` 转换成 json 字符串 格式："key1":{ "v":"value1" }

      Parameters:
        `map` - `Map<String, String> map`
      Returns:

        字符串

    - #### mergeJson

           static List<String> mergeJson(String expansionJsonSet, String expansionExisted)

      将两个带时间戳的 json 串合并

      Parameters:
        `expansionJsonSet` - 字符串
        `expansionExisted` - 字符串
      Returns:

        合并后的全量和增量数据