JsonUtil
@UnstableApi
public final class JsonUtil
Utilities for working with JSON
Summary
Public methods |
|
|---|---|
static @Nullable JSONObject |
exceptionAsJsonObject(@Nullable Exception exception)Creates a |
static JSONObject |
exportResultAsJsonObject(ExportResult exportResult)Creates a |
static JSONObject |
Returns a |
static JSONArray |
processedInputsAsJsonArray(Creates a |
Public methods
exceptionAsJsonObject
public static @Nullable JSONObject exceptionAsJsonObject(@Nullable Exception exception)
Creates a JSONObject from the Exception.
If the exception is an ExportException, errorCode is included.
| Returns | |
|---|---|
@Nullable JSONObject |
The |
| Throws | |
|---|---|
org.json.JSONException |
if this method attempts to create a JSON with null key. |
exportResultAsJsonObject
public static JSONObject exportResultAsJsonObject(ExportResult exportResult)
Creates a JSONObject from the ExportResult.
| Parameters | |
|---|---|
ExportResult exportResult |
The |
| Returns | |
|---|---|
JSONObject |
The |
| Throws | |
|---|---|
org.json.JSONException |
if this method attempts to create a JSON with null key. |
getDeviceDetailsAsJsonObject
public static JSONObject getDeviceDetailsAsJsonObject()
Returns a JSONObject containing device specific details from Build, including manufacturer, model, SDK version and build fingerprint.
| Throws | |
|---|---|
org.json.JSONException |
processedInputsAsJsonArray
public static JSONArray processedInputsAsJsonArray(
ImmutableList<ExportResult.ProcessedInput> processedInputs
)
Creates a JSONArray from processed inputs.
| Parameters | |
|---|---|
ImmutableList<ExportResult.ProcessedInput> processedInputs |
The list of |
| Returns | |
|---|---|
JSONArray |
A |
| Throws | |
|---|---|
org.json.JSONException |
if this method attempts to create a JSON with null key. |