edu.internet2.ndt

## Class JSONUtils

- java.lang.Object
- - edu.internet2.ndt.JSONUtils

-     public class JSONUtils
      extends Object

  Utility class for JSON object manipulation and message handling.

- - ### Constructor Summary

    Constructors
    Constructor and Description
    `JSONUtils()`

  - ### Method Summary

    All Methods Static Methods Concrete Methods
    Modifier and Type | Method and Description
    --- | ---
    `static String` | `addValueToJsonObj(String jsonTxt, String key, String value)` Function that add new value to JSON map
    `static byte[]` | `createJsonLoginObj(byte[] msg, byte tests)` Function that return json object represented by jsontext and included single message assigned to "msg" key
    `static byte[]` | `createJsonObj(byte[] msg)` Function that return json object represented by jsontext and included single message assigned to "msg" key
    `static String` | `getSingleMessage(String jsonTxt)` Function that return value from json object represented by jsontext containing a single message which is assigned to "msg" key.
    `static String` | `getValueFromJsonObj(String jsonTxt, String key)` Function that return value for given key from json object represented by jsontext

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

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

- - ### Constructor Detail

    - #### JSONUtils

          public JSONUtils()

  - ### Method Detail

    - #### addValueToJsonObj

          public static String addValueToJsonObj(String jsonTxt,
                                                 String key,
                                                 String value)

      Function that add new value to JSON map
      Parameters:
        `jsonTxt` - {String} JSON object
        `key` - {String} key by which value should be assigned to JSON map
        `value` - {String} value for given key
      Returns:
        {String} json object with added value.

    - #### createJsonLoginObj

          public static byte[] createJsonLoginObj(byte[] msg,
                                                  byte tests)

      Function that return json object represented by jsontext and included single message assigned to "msg" key
      Parameters:
        `msg` - {byte[]} message which should be assigned to json object
      Returns:
        {byte[]} json object represented by jsontext and encodes into a sequence of bytes

    - #### createJsonObj

          public static byte[] createJsonObj(byte[] msg)

      Function that return json object represented by jsontext and included single message assigned to "msg" key
      Parameters:
        `msg` - {byte[]} message which should be assigned to json object
      Returns:
        {byte[]} json object represented by jsontext and encodes into a sequence of bytes

    - #### getSingleMessage

          public static String getSingleMessage(String jsonTxt)

      Function that return value from json object represented by jsontext containing a single message which is assigned to "msg" key.
      Parameters:
        `jsonTxt` - {String} JSON object
      Returns:
        {int} obtained value from JSON object

    - #### getValueFromJsonObj

          public static String getValueFromJsonObj(String jsonTxt,
                                                   String key)

      Function that return value for given key from json object represented by jsontext
      Parameters:
        `jsonTxt` - {String} JSON object
        `key` - {int} key by which value should be obtained from JSON map
      Returns:
        {int} obtained value from JSON map