org.apache.sling.xss

## Class JSONUtil

- java.lang.Object
- - org.apache.sling.xss.JSONUtil

Deprecated.

    @Deprecated
    public final class JSONUtil
    extends Object

JSON utilities

Support for handling xss protected values with JSON objects and JSON writers.

### Field Summary

Fields
`static String` `KEY_SUFFIX_XSS` Deprecated. Key suffix for XSS protected properties

### Method Summary

All Methods Static Methods Concrete Methods Deprecated Methods
`static void` `putProtected(org.apache.sling.commons.json.JSONObject object, String key, String value, XSSFilter xss)` Deprecated. Puts a xss protected value into a JSON object.
`static void` `putWithProtected(org.apache.sling.commons.json.JSONObject object, String key, String value, XSSFilter xss)` Deprecated. Puts a value into a JSON object In addition, the xss protected value is put under the provided key appended by `KEY_SUFFIX_XSS`
`static void` `writeProtected(org.apache.sling.commons.json.io.JSONWriter writer, String key, String[] values, XSSFilter xss)` Deprecated. Writes a xss protected value array into a JSON writer.
`static void` `writeProtected(org.apache.sling.commons.json.io.JSONWriter writer, String key, String value, XSSFilter xss)` Deprecated. Writes a xss protected value into a JSON writer.
`static void` `writeWithProtected(org.apache.sling.commons.json.io.JSONWriter writer, String key, String[] values, XSSFilter xss)` Deprecated. Writes a value array into a JSON write.
`static void` `writeWithProtected(org.apache.sling.commons.json.io.JSONWriter writer, String key, String value, XSSFilter xss)` Deprecated. Writes a value into a JSON write In addition, the xss protected value is written with the provided key appended by `KEY_SUFFIX_XSS`

### Methods inherited from class java.lang.Object

`clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

### Field Detail

#### KEY_SUFFIX_XSS

    public static final String KEY_SUFFIX_XSS

Deprecated.
Key suffix for XSS protected properties

See Also:
  Constant Field Values

### Method Detail

#### putProtected

    public static void putProtected(org.apache.sling.commons.json.JSONObject object,
                                    String key,
                                    String value,
                                    XSSFilter xss)
                             throws org.apache.sling.commons.json.JSONException

Deprecated.
Puts a xss protected value into a JSON object. The value is put under the provided key.

Parameters:
  `object` - JSON object
  `key` - Key to write
  `value` - Value to write
  `xss` - XSS protection filter
Throws:
  `org.apache.sling.commons.json.JSONException` - If value could not be put into the object
  `NullPointerException` - If xss protection filter is `null`

#### putWithProtected

    public static void putWithProtected(org.apache.sling.commons.json.JSONObject object,
                                        String key,
                                        String value,
                                        XSSFilter xss)
                                 throws org.apache.sling.commons.json.JSONException

Deprecated.
Puts a value into a JSON object In addition, the xss protected value is put under the provided key appended by `KEY_SUFFIX_XSS`

Parameters:
  `object` - JSON object
  `key` - Key to write
  `value` - Value to write
  `xss` - XSS protection filter
Throws:
  `org.apache.sling.commons.json.JSONException` - If value could not be put into the object
  `NullPointerException` - If xss protection filter is `null`

#### writeProtected

    public static void writeProtected(org.apache.sling.commons.json.io.JSONWriter writer,
                                      String key,
                                      String value,
                                      XSSFilter xss)
                               throws org.apache.sling.commons.json.JSONException

Deprecated.
Writes a xss protected value into a JSON writer. The value is written under the provided key.

Parameters:
  `writer` - JSON writer
  `key` - Key to write
  `value` - Value to write
  `xss` - XSS protection filter
Throws:
  `org.apache.sling.commons.json.JSONException` - If value could not be written
  `NullPointerException` - If xss protection filter is `null`

#### writeProtected

    public static void writeProtected(org.apache.sling.commons.json.io.JSONWriter writer,
                                      String key,
                                      String[] values,
                                      XSSFilter xss)
                               throws org.apache.sling.commons.json.JSONException

Deprecated.
Writes a xss protected value array into a JSON writer. The values are written under the provided key.

Parameters:
  `writer` - The JSON writer.
  `key` - Key to use.
  `values` - The value arrays.
  `xss` - The XSS protection filter.
Throws:
  `org.apache.sling.commons.json.JSONException` - If an JSON specific error occurs.
  `NullPointerException` - If xss protection filter is `null`

#### writeWithProtected

    public static void writeWithProtected(org.apache.sling.commons.json.io.JSONWriter writer,
                                          String key,
                                          String value,
                                          XSSFilter xss)
                                   throws org.apache.sling.commons.json.JSONException

Deprecated.
Writes a value into a JSON write In addition, the xss protected value is written with the provided key appended by `KEY_SUFFIX_XSS`

Parameters:
  `writer` - JSON writer
  `key` - Key to write
  `value` - Value to write
  `xss` - XSS protection filter
Throws:
  `org.apache.sling.commons.json.JSONException` - If value could not be written
  `NullPointerException` - If xss protection filter is `null`

#### writeWithProtected

    public static void writeWithProtected(org.apache.sling.commons.json.io.JSONWriter writer,
                                          String key,
                                          String[] values,
                                          XSSFilter xss)
                                   throws org.apache.sling.commons.json.JSONException

Deprecated.
Writes a value array into a JSON write. In addition, the xss protected values are written with the provided key appended by `KEY_SUFFIX_XSS`

Parameters:
  `writer` - The JSON writer to use.
  `key` - The key to write.
  `values` - The value array.
  `xss` - The xss protection filter.
Throws:
  `org.apache.sling.commons.json.JSONException` - If a JSON specific error occurs.
  `NullPointerException` - If xss protection filter is `null`