# Class: com.pnfsoftware.jeb.util.encoding.JsonUtil

JSON utility methods backed by Jackson.

## Static Method: copy
- parameter: `map`, type: `java.util.Map<java.lang.String,java.lang.Object>`
- return type: `java.util.Map<java.lang.String,java.lang.Object>`

Description: Deep copy a Json object.
parameter: map: the input Json object
return: a copy of the input Json object
throws: 

## Static Method: formatJson
- parameter: `json`, type: `java.lang.String`
- return type: `java.lang.String`

Description: Pretty\-print a JSON document.
parameter: json: input JSON document
return: formatted JSON document
throws: if the input cannot be parsed or serialized

## Static Method: get
- parameter: `map`, type: `java.util.Map<java.lang.String,java.lang.Object>`
- parameter: `path`, type: `java.lang.String`
- return type: `java.lang.Object`

Description: Retrieve the value inside a Json object. This method throws if the path is incorrect or invalid.
parameter: map: Json object
parameter: path: path, such as: `foo.bar[2].blah[0][3].x`
return: the object \(may be null\)

## Static Method: jsonToMap
- parameter: `str`, type: `java.lang.String`
- return type: `java.util.Map<java.lang.String,java.lang.Object>`

Description: Parse a JSON object into a string\-keyed map.
parameter: str: JSON object text
return: parsed map
throws: if the input cannot be parsed as a JSON object

## Static Method: jsonToObject
- parameter: `str`, type: `java.lang.String`
- return type: `java.lang.Object`

Description: Parse JSON text into the default Jackson representation.
parameter: str: JSON text
return: parsed value
throws: if the input cannot be parsed

## Static Method: jsonToPojo
- parameter: `str`, type: `java.lang.String`
- parameter: `clz`, type: `java.lang.Class<T>`
- return type: `T`

Description: Parse JSON text and convert it to a POJO.
parameter: str: JSON text
parameter: clz: target class
return: converted object
parameter: T: target type
throws: if the input cannot be parsed

## Static Method: map
- parameter: `k`, type: `java.lang.String`
- parameter: `v`, type: `java.lang.Object`
- return type: `java.util.Map<java.lang.String,java.lang.Object>`

Description: Create an insertion\-ordered map containing one entry.
parameter: k: entry key
parameter: v: entry value
return: new map

## Static Method: map
- parameter: `k1`, type: `java.lang.String`
- parameter: `v1`, type: `java.lang.Object`
- parameter: `k2`, type: `java.lang.String`
- parameter: `v2`, type: `java.lang.Object`
- return type: `java.util.Map<java.lang.String,java.lang.Object>`

Description: Create an insertion\-ordered map containing two entries.
parameter: k1: first entry key
parameter: v1: first entry value
parameter: k2: second entry key
parameter: v2: second entry value
return: new map

## Static Method: map
- parameter: `k1`, type: `java.lang.String`
- parameter: `v1`, type: `java.lang.Object`
- parameter: `k2`, type: `java.lang.String`
- parameter: `v2`, type: `java.lang.Object`
- parameter: `k3`, type: `java.lang.String`
- parameter: `v3`, type: `java.lang.Object`
- return type: `java.util.Map<java.lang.String,java.lang.Object>`

Description: Create an insertion\-ordered map containing three entries.
parameter: k1: first entry key
parameter: v1: first entry value
parameter: k2: second entry key
parameter: v2: second entry value
parameter: k3: third entry key
parameter: v3: third entry value
return: new map

## Static Method: map
- parameter: `k1`, type: `java.lang.String`
- parameter: `v1`, type: `java.lang.Object`
- parameter: `k2`, type: `java.lang.String`
- parameter: `v2`, type: `java.lang.Object`
- parameter: `k3`, type: `java.lang.String`
- parameter: `v3`, type: `java.lang.Object`
- parameter: `k4`, type: `java.lang.String`
- parameter: `v4`, type: `java.lang.Object`
- return type: `java.util.Map<java.lang.String,java.lang.Object>`

Description: Create an insertion\-ordered map containing four entries.
parameter: k1: first entry key
parameter: v1: first entry value
parameter: k2: second entry key
parameter: v2: second entry value
parameter: k3: third entry key
parameter: v3: third entry value
parameter: k4: fourth entry key
parameter: v4: fourth entry value
return: new map

## Static Method: mapToPojo
- parameter: `map`, type: `java.util.Map<java.lang.String,java.lang.Object>`
- parameter: `clz`, type: `java.lang.Class<T>`
- return type: `T`

Description: Convert a string\-keyed map to a POJO.
parameter: map: map to convert
parameter: clz: target class
return: converted object
parameter: T: target type

## Static Method: objectToJson
- parameter: `obj`, type: `java.lang.Object`
- return type: `java.lang.String`

Description: Serialize an object to a pretty\-printed JSON document.
parameter: obj: object to serialize
return: JSON document
throws: if the object cannot be serialized

## Static Method: pojoToMap
- parameter: `obj`, type: `java.lang.Object`
- return type: `java.util.Map<java.lang.String,java.lang.Object>`

Description: Convert a POJO to a string\-keyed map.
parameter: obj: object to convert
return: converted map

## Static Method: remove
- parameter: `map`, type: `java.util.Map<java.lang.String,java.lang.Object>`
- parameter: `path`, type: `java.lang.String`
- return type: `java.lang.Object`

Description: Remove an entry inside a Json object. This method throws if the path is incorrect or invalid.
parameter: map: Json object
parameter: path: path, such as: `"foo.bar[2].blah[0][3].x"`
return: the deleted value \(may be null\)

## Static Method: replace
- parameter: `map`, type: `java.util.Map<java.lang.String,java.lang.Object>`
- parameter: `path`, type: `java.lang.String`
- parameter: `repl`, type: `java.lang.Object`
- return type: `java.lang.Object`

Description: Replace a value inside a Json object. This method throws if the path is incorrect or invalid.
parameter: map: Json object
parameter: path: path, such as: `"foo.bar[2].blah[0][3].x"`
parameter: repl: the new object \(may be null; the associated key will not be removed\)
return: the previous value \(may be null\)

## Static Method: toPojo
- parameter: `obj`, type: `java.lang.Object`
- parameter: `clz`, type: `java.lang.Class<T>`
- return type: `T`

Description: Convert a Map or parse a JSON text and to a POJO.
parameter: obj: a Map or a JSON string
parameter: clz: target class
return: converted object
parameter: T: target type
throws: if the input cannot be parsed

