public final class JsonUtil extends Object
 We use the lightweight JSON library `jackson-jr` to parse the given
 input or to convert the given objects to JSON string. If
 `jackson-annotations` library present on the classpath, we register
 JacksonAnnotationExtension to so that the JSON conversion can
 make use of 
 Jackson Annotations.
| Modifier and Type | Method and Description | 
|---|---|
| static Object | anyFrom(String jsonString)Converts a JSON string to an Object. | 
| static <T> T | beanFrom(String jsonString,
        Class<T> type)Converts a JSON string to an object of the given type. | 
| static <T> Stream<T> | beanSequenceFrom(Path path,
                Class<T> type)Parses the file and returns a stream of objects with the given type. | 
| static <T> Iterator<T> | beanSequenceFrom(Reader reader,
                Class<T> type)Returns an  Iteratorover the sequence of JSON objects parsed
 from givenreader. | 
| static HazelcastJsonValue | hazelcastJsonValue(Object object)Creates a  HazelcastJsonValueby converting given the object to
 string usingObject.toString(). | 
| static List<Object> | listFrom(String jsonString)Converts a JSON string to a  List. | 
| static <T> List<T> | listFrom(String jsonString,
        Class<T> type)Converts a JSON string to a  Listof given type. | 
| static Map<String,Object> | mapFrom(Object object)Converts a JSON string to a  Map. | 
| static Stream<Map<String,Object>> | mapSequenceFrom(Path path)Parses the file and returns a stream of  Map. | 
| static Iterator<Map<String,Object>> | mapSequenceFrom(Reader reader)Returns an  Iteratorover the sequence of JSON objects parsed
 from givenreader. | 
| static String | toJson(Object object)Creates a JSON string for the given object. | 
@Nonnull public static HazelcastJsonValue hazelcastJsonValue(@Nonnull Object object)
HazelcastJsonValue by converting given the object to
 string using Object.toString().@Nullable public static <T> T beanFrom(@Nonnull String jsonString, @Nonnull Class<T> type) throws IOException
IOException@Nullable public static Map<String,Object> mapFrom(@Nonnull Object object) throws IOException
Map.IOException@Nullable public static <T> List<T> listFrom(@Nonnull String jsonString, @Nonnull Class<T> type) throws IOException
List of given type.IOException@Nullable public static List<Object> listFrom(@Nonnull String jsonString) throws IOException
List.IOException@Nullable public static Object anyFrom(@Nonnull String jsonString) throws IOException
Map. See
     mapFrom(Object).List. See
     listFrom(String).IOException@Nonnull public static <T> Iterator<T> beanSequenceFrom(@Nonnull Reader reader, @Nonnull Class<T> type) throws IOException
Iterator over the sequence of JSON objects parsed
 from given reader. Each object is converted to the given
 type.IOException@Nonnull public static Iterator<Map<String,Object>> mapSequenceFrom(@Nonnull Reader reader) throws IOException
Iterator over the sequence of JSON objects parsed
 from given reader. Each object is converted to a Map.
 It will throw ClassCastException if JSON objects are just
 primitives (String, Number, Boolean) or JSON
 arrays (List).IOException@Nonnull public static <T> Stream<T> beanSequenceFrom(Path path, @Nonnull Class<T> type) throws IOException
IOException@Nonnull public static Stream<Map<String,Object>> mapSequenceFrom(Path path) throws IOException
Map. The file is
 considered to have a
 streaming JSON
 content, where each JSON string is separated by a new-line. The JSON
 string itself can span on multiple lines.
 IOException@Nonnull public static String toJson(@Nonnull Object object) throws IOException
IOExceptionCopyright © 2022 Hazelcast, Inc.. All rights reserved.