public class Json
extends java.lang.Object
| Constructor and Description |
|---|
Json() |
| Modifier and Type | Method and Description |
|---|---|
static <T> T |
convert(java.lang.Class<T> clazz,
java.lang.String jsonData)
Convert 'json object' to a certain type.
|
static <T> T |
fromJson(com.google.gson.GsonBuilder builder,
java.lang.String jsonString,
java.lang.Class<T> type)
Provide a flexible way to convert a JSON String to a certain type.
User can provide its own GsonBuilder. |
static <T> T |
fromJson(com.google.gson.GsonBuilder builder,
java.lang.String jsonString,
java.lang.reflect.Type type)
Provide a flexible way to convert a JSON String to a certain type.
User can provide its own GsonBuilder. |
static <T> T |
fromJsonString(java.lang.String jsonString,
java.lang.Class<T> type)
Convert a JSON String to a certain type.
Note: It needs com.google.gson.Gson, which is currently included in the selenium-server-standalone jar. |
static boolean |
jsonsEqual(java.lang.Object obj1,
java.lang.Object obj2)
Jason object/array object compare
|
static void |
main(java.lang.String[] args) |
static java.util.Map<?,?> |
readJSONFile(java.lang.String file,
java.lang.String encoding)
Read a JSON data file, and convert the data into a Java Map and return it.
|
static java.util.Map<?,?> |
readJSONFileUTF8(java.lang.String file)
Read a JSON data file with UTF-8 encoding, and convert the data into a Java Map and return it.
|
public static boolean jsonsEqual(java.lang.Object obj1,
java.lang.Object obj2)
throws org.json.JSONException
obj1 - obj2 - org.json.JSONExceptionpublic static java.util.Map<?,?> readJSONFileUTF8(java.lang.String file)
file - String, the absolute JSON file.public static java.util.Map<?,?> readJSONFile(java.lang.String file,
java.lang.String encoding)
file - String, the absolute JSON file.encoding - String, the JSON file encoding.public static <T> T convert(java.lang.Class<T> clazz,
java.lang.String jsonData)
clazz - ClassjsonData - String, the json data object.public static <T> T fromJsonString(java.lang.String jsonString,
java.lang.Class<T> type)
jsonString - String, the JSON string.type - Classpublic static <T> T fromJson(com.google.gson.GsonBuilder builder,
java.lang.String jsonString,
java.lang.Class<T> type)
builder - GsonBuilder, the user-provided builder.jsonString - String, the JSON string.type - Classpublic static <T> T fromJson(com.google.gson.GsonBuilder builder,
java.lang.String jsonString,
java.lang.reflect.Type type)
builder - GsonBuilder, the user-provided builder.jsonString - String, the JSON string.type - Type, the type of object which "JSON String" to be converted.public static void main(java.lang.String[] args)
Copyright © SAS Institute. All Rights Reserved.