## com.baidubce.util
Class JsonUtils

    java.lang.Object
      com.baidubce.util.JsonUtils

    public class JsonUtils

extends Object

Constructor Summary
`JsonUtils()`

Method Summary

`static

`<T> T`

`

`fromJsonString(String json, Class<T> clazz)`
Returns the deserialized object from the given json string and target class; or null if the given json string is null.

`static com.fasterxml.jackson.databind.ObjectMapper` `getObjectMapper()`
`static com.fasterxml.jackson.databind.ObjectWriter` `getPrettywriter()`
`static com.fasterxml.jackson.databind.ObjectWriter` `getWriter()`
`static com.fasterxml.jackson.core.JsonGenerator` `jsonGeneratorOf(Writer writer)`
`static com.fasterxml.jackson.databind.JsonNode` `jsonNodeOf(String json)`
`static void` `load(InputStream input, Object obj)`

`static

`<T> T`

`

`loadFrom(File file, Class<T> clazz)`

`static

`<T> T`

`

`loadFrom(InputStream input, Class<T> clazz)`

`static String` `toJsonPrettyString(Object value)`
`static String` `toJsonString(Object value)`

Methods inherited from class java.lang.Object
`clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

Constructor Detail

### JsonUtils

    public JsonUtils()

Method Detail

### toJsonPrettyString

    public static String toJsonPrettyString(Object value)
                                     throws com.fasterxml.jackson.core.JsonProcessingException

  Throws:
    `com.fasterxml.jackson.core.JsonProcessingException`

### toJsonString

    public static String toJsonString(Object value)

### fromJsonString

    public static <T> T fromJsonString(String json,
                                       Class<T> clazz)

  Returns the deserialized object from the given json string and target class; or null if the given json string is null.

### jsonNodeOf

    public static com.fasterxml.jackson.databind.JsonNode jsonNodeOf(String json)

### jsonGeneratorOf

    public static com.fasterxml.jackson.core.JsonGenerator jsonGeneratorOf(Writer writer)
                                                                    throws IOException

  Throws:
    `IOException`

### loadFrom

    public static <T> T loadFrom(File file,
                                 Class<T> clazz)
                      throws IOException

  Throws:
    `IOException`

### load

    public static void load(InputStream input,
                            Object obj)
                     throws IOException,
                            com.fasterxml.jackson.core.JsonProcessingException

  Throws:
    `IOException`
    `com.fasterxml.jackson.core.JsonProcessingException`

### loadFrom

    public static <T> T loadFrom(InputStream input,
                                 Class<T> clazz)
                      throws com.fasterxml.jackson.core.JsonParseException,
                             com.fasterxml.jackson.databind.JsonMappingException,
                             IOException

  Throws:
    `com.fasterxml.jackson.core.JsonParseException`
    `com.fasterxml.jackson.databind.JsonMappingException`
    `IOException`

### getObjectMapper

    public static com.fasterxml.jackson.databind.ObjectMapper getObjectMapper()

### getWriter

    public static com.fasterxml.jackson.databind.ObjectWriter getWriter()

### getPrettywriter

    public static com.fasterxml.jackson.databind.ObjectWriter getPrettywriter()

Copyright © 2016. All rights reserved.