@ThingworxExtensionApiClass(since={6,6}, canInstantiate=true) public final class JSONUtilities extends java.lang.Object
Modifier and Type | Field and Description |
---|---|
static java.lang.String |
ARRAY_PROPERTY |
Constructor and Description |
---|
JSONUtilities() |
Modifier and Type | Method and Description |
---|---|
static boolean |
isJSONArray(java.io.InputStream stream) |
static boolean |
isJSONArray(java.io.Reader reader) |
static boolean |
isJSONArray(java.lang.String content) |
static void |
printInfoTableToWriter(java.io.PrintWriter writer,
InfoTable it)
Deprecated.
no replacement
|
static void |
printJSON(java.io.PrintWriter writer,
org.json.JSONObject jsonObject) |
static void |
printJSONFormatted(java.io.PrintWriter writer,
org.json.JSONObject jsonObject) |
static org.json.JSONObject |
readJSON(java.io.InputStream stream) |
static org.json.JSONObject |
readJSON(java.io.Reader reader) |
static org.json.JSONObject |
readJSON(java.lang.String content) |
static org.json.JSONArray |
readJSONArray(java.io.InputStream input) |
static org.json.JSONArray |
readJSONArray(java.io.Reader reader) |
static org.json.JSONArray |
readJSONArray(java.lang.String content) |
static ValueCollection |
readValueCollectionFromString(java.lang.String jsonString,
DataShapeDefinition dataShape) |
static void |
validateJSON(java.lang.String content)
Validate the incoming string for JSON specification and leading and ending braces. |
static org.json.JSONObject |
wrapJSONArray(org.json.JSONArray jsonArray) |
static java.lang.String |
writeInfoTableToString(InfoTable it)
Deprecated.
no replacement
|
static void |
writeInfoTableToWriter(java.io.Writer writer,
InfoTable it)
Deprecated.
no replacement
|
static java.lang.String |
writeJSON(org.json.JSONObject jsonObject) |
static void |
writeJSON(org.json.JSONObject jsonObject,
java.io.OutputStream stream) |
static void |
writeJSON(org.json.JSONObject jsonObject,
java.io.Writer writer) |
static java.lang.String |
writeJSONArray(org.json.JSONArray jsonArray) |
static java.lang.String |
writeJSONFormatted(org.json.JSONObject jsonObject) |
static void |
writeJSONFormatted(org.json.JSONObject jsonObject,
java.io.OutputStream stream) |
static void |
writeJSONFormatted(org.json.JSONObject jsonObject,
java.io.Writer writer) |
static java.lang.String |
writeValueCollectionToString(ValueCollection values,
DataShapeDefinition dataShape)
Deprecated.
no replacement
|
public static final java.lang.String ARRAY_PROPERTY
@ThingworxExtensionApiMethod(since={6,6}) public static boolean isJSONArray(java.lang.String content)
@ThingworxExtensionApiMethod(since={6,6}) public static boolean isJSONArray(java.io.InputStream stream)
@ThingworxExtensionApiMethod(since={6,6}) public static boolean isJSONArray(java.io.Reader reader)
@ThingworxExtensionApiMethod(since={6,6}) public static org.json.JSONArray readJSONArray(java.lang.String content)
@ThingworxExtensionApiMethod(since={6,6}) public static org.json.JSONArray readJSONArray(java.io.InputStream input)
@ThingworxExtensionApiMethod(since={6,6}) public static org.json.JSONArray readJSONArray(java.io.Reader reader)
@ThingworxExtensionApiMethod(since={6,6}) public static org.json.JSONObject wrapJSONArray(org.json.JSONArray jsonArray) throws org.json.JSONException
org.json.JSONException
- If an error occurs@ThingworxExtensionApiMethod(since={6,6}) public static org.json.JSONObject readJSON(java.lang.String content)
@ThingworxExtensionApiMethod(since={6,6}) public static org.json.JSONObject readJSON(java.io.InputStream stream)
@ThingworxExtensionApiMethod(since={6,6}) public static org.json.JSONObject readJSON(java.io.Reader reader)
@ThingworxExtensionApiMethod(since={6,6}) public static java.lang.String writeJSONFormatted(org.json.JSONObject jsonObject)
@ThingworxExtensionApiMethod(since={6,6}) public static void writeJSONFormatted(org.json.JSONObject jsonObject, java.io.Writer writer) throws java.lang.Exception
java.lang.Exception
- If an error occurs@ThingworxExtensionApiMethod(since={6,6}) public static void writeJSONFormatted(org.json.JSONObject jsonObject, java.io.OutputStream stream) throws java.lang.Exception
java.lang.Exception
- If an error occurs@ThingworxExtensionApiMethod(since={6,6}) public static java.lang.String writeJSON(org.json.JSONObject jsonObject)
@ThingworxExtensionApiMethod(since={6,6}) public static void writeJSON(org.json.JSONObject jsonObject, java.io.OutputStream stream) throws java.lang.Exception
java.lang.Exception
- If an error occurs@ThingworxExtensionApiMethod(since={6,6}) public static void writeJSON(org.json.JSONObject jsonObject, java.io.Writer writer) throws java.lang.Exception
java.lang.Exception
- If an error occurs@ThingworxExtensionApiMethod(since={6,6}) public static java.lang.String writeJSONArray(org.json.JSONArray jsonArray)
@ThingworxExtensionApiMethod(since={6,6}) public static void printJSON(java.io.PrintWriter writer, org.json.JSONObject jsonObject) throws java.lang.Exception
java.lang.Exception
- If an error occurs@ThingworxExtensionApiMethod(since={6,6}) public static void printJSONFormatted(java.io.PrintWriter writer, org.json.JSONObject jsonObject) throws java.lang.Exception
java.lang.Exception
- If an error occurs@Deprecated @ThingworxExtensionApiMethod(since={6,6}, deprecatedSince={8,4}) public static void writeInfoTableToWriter(java.io.Writer writer, InfoTable it) throws java.lang.Exception
writer
- the writerit
- the InfoTablejava.lang.Exception
- if an exception occurs@Deprecated @ThingworxExtensionApiMethod(since={6,6}, deprecatedSince={8,4}) public static void printInfoTableToWriter(java.io.PrintWriter writer, InfoTable it) throws java.lang.Exception
writer
- the writerit
- the InfoTablejava.lang.Exception
- if an exception occurs@Deprecated @ThingworxExtensionApiMethod(since={6,6}, deprecatedSince={8,4}) public static java.lang.String writeInfoTableToString(InfoTable it) throws java.lang.Exception
it
- the InfoTablejava.lang.Exception
- if an error occurs@Deprecated @ThingworxExtensionApiMethod(since={6,6}, deprecatedSince={8,4}) public static java.lang.String writeValueCollectionToString(ValueCollection values, DataShapeDefinition dataShape) throws java.lang.Exception
values
- the ValueCollectiondataShape
- the DataShapeDefinitionjava.lang.Exception
- if an error occurs@ThingworxExtensionApiMethod(since={6,6}) public static ValueCollection readValueCollectionFromString(java.lang.String jsonString, DataShapeDefinition dataShape) throws java.lang.Exception
java.lang.Exception
- If an error occurs@ThingworxExtensionApiMethod(since={7,2,0}) public static void validateJSON(java.lang.String content) throws java.lang.Exception
content
- - String representation of the JSON to validatejava.lang.Exception
- When the provided string is found to be invalid. This exception's message can be used for error reporting.