# JSONException

public class **JSONException** extends Exception  
Thrown to indicate a problem with the JSON API. Such problems include:

- Attempts to parse or construct malformed documents
- Use of null as a name
- Use of numeric types not available to JSON, such as `https://developers.google.com/j2objc/javadoc/android/reference/java/lang/Double.html#isNaN()` or `https://developers.google.com/j2objc/javadoc/android/reference/java/lang/Double.html#isInfinite()`.
- Lookups using an out of range index or nonexistent name
- Type mismatches on lookups

Although this is a checked exception, it is rarely recoverable. Most
callers should simply wrap this exception in an unchecked exception and
rethrow:

```
  public JSONArray toJSONObject() {
     try {
         JSONObject result = new JSONObject();
         ...
     } catch (JSONException e) {
         throw new RuntimeException(e);
     }
 }
```

<br />

### Public Constructor Summary

|---|---|
|   | [JSONException](https://developers.google.com/j2objc/javadoc/android/reference/org/json/JSONException.html#JSONException(java.lang.String))(String s) |
|   | [JSONException](https://developers.google.com/j2objc/javadoc/android/reference/org/json/JSONException.html#JSONException(java.lang.String,%20java.lang.Throwable))(String message, Throwable cause) |
|   | [JSONException](https://developers.google.com/j2objc/javadoc/android/reference/org/json/JSONException.html#JSONException(java.lang.Throwable))(Throwable cause) |

### Inherited Method Summary

From class java.lang.Throwable

|---|---|
| synchronized final void | addSuppressed(Throwable arg0) |
| synchronized Throwable | fillInStackTrace() |
| synchronized Throwable | getCause() |
| String | getLocalizedMessage() |
| String | getMessage() |
| StackTraceElement\[\] | getStackTrace() |
| synchronized final Throwable\[\] | getSuppressed() |
| synchronized Throwable | initCause(Throwable arg0) |
| void | printStackTrace() |
| void | printStackTrace(PrintWriter arg0) |
| void | printStackTrace(PrintStream arg0) |
| void | setStackTrace(StackTraceElement\[\] arg0) |
| String | toString() |

From class java.lang.Object

|---|---|
| Object | clone() |
| boolean | equals(Object arg0) |
| void | finalize() |
| final Class\<?\> | getClass() |
| int | hashCode() |
| final void | notify() |
| final void | notifyAll() |
| String | toString() |
| final void | wait(long arg0, int arg1) |
| final void | wait(long arg0) |
| final void | wait() |

## Public Constructors

#### public
**JSONException**
(String s)

<br />

##### Parameters

| s |   |
|---|---|

#### public
**JSONException**
(String message, Throwable cause)

<br />

##### Parameters

| message |   |
| cause |   |
|---|---|

#### public
**JSONException**
(Throwable cause)

<br />

##### Parameters

| cause |   |
|---|---|