Class JSONUtils

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

public class JSONUtils extends Object
Created by Sebastian Malecki on 13.05.14.
  • Constructor Details

    • JSONUtils

      public JSONUtils()
  • Method Details

    • 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
    • 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.
    • 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
    • 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
      Since:
      0.9.45