Class JsonGeneratorImpl

    • Constructor Detail

      • JsonGeneratorImpl

        public JsonGeneratorImpl()
    • Method Detail

      • createJsonArray

        public JsonValue createJsonArray​(Collection<?> collection)
                                  throws JsonException
        Create JSON array from specified collection.
        Parameters:
        collection - source collection
        Returns:
        JSON representation of collection
        Throws:
        JsonException - if collection can't be transformed in JSON representation
      • createJsonArray

        public JsonValue createJsonArray​(Object array)
                                  throws JsonException
        Create JSON array from specified object. Parameter array must be array.
        Parameters:
        array - source array
        Returns:
        JSON representation of array
        Throws:
        JsonException - if array can't be transformed in JSON representation
      • createJsonObjectFromMap

        public JsonValue createJsonObjectFromMap​(Map<String,​?> map)
                                          throws JsonException
        Create JSON object from specified map.
        Parameters:
        map - source map
        Returns:
        JSON representation of map
        Throws:
        JsonException - if map can't be transformed in JSON representation
      • createJsonObjectFromString

        public JsonValue createJsonObjectFromString​(String s)
                                             throws JsonException
        Create JSON object from specified string imply it is JSON object in String format.
        Parameters:
        s - source string
        Returns:
        JSON representation of map
        Throws:
        JsonException - if map can't be transformed in JSON representation
      • createJsonObject

        public JsonValue createJsonObject​(Object object)
                                   throws JsonException
        Create JSON object from specified object. Object must be conform with java bean structure.
        Specified by:
        createJsonObject in interface JsonGenerator
        Parameters:
        object - source object
        Returns:
        JSON representation of object
        Throws:
        JsonException - if map can't be transformed in JSON representation