Updated on 2022-09-01 GMT+08:00

JSONHelper

Path

com.huawei.livedata.lambdaservice.util.JSONHelper

Description

This class is used to perform conversion between JSON and XML and between JSON and Map.

Method List

Returned Type

Method and Description

static String

json2Xml(String json)

Convert from JSON to XML.

static String

xml2Json(String xml)

Convert from XML to JSON.

static String

json2XmlWithoutType(String json)

Convert from JSON to XML.

static HashMap

jsonToMap(String json)

Convert from JSON to Map.

Method Details

  • public static String json2Xml(String json)

    Convert from JSON to XML.

    Input Parameter

    json indicates a character string in JSON format.

    Returns

    Character string in the XML format.

  • public static String xml2Json(String xml)

    Convert from XML to JSON.

    Input Parameter

    xml indicates a character string in XML format.

    Returns

    Character string in the JSON format.

  • public static String json2XmlWithoutType(String json)

    Convert from JSON to XML.

    Input Parameter

    json indicates a character string in JSON format.

    Returns

    Character string in the XML format.

  • public static HashMap jsonToMap(String json)

    Convert from JSON to Map.

    Input Parameter

    json indicates a character string in JSON format.

    Returns

    Character string in the Map format.