Package edu.internet2.ndt
Class JSONUtils
java.lang.Object
edu.internet2.ndt.JSONUtils
Created by Sebastian Malecki on 13.05.14.
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionstatic String
addValueToJsonObj
(String jsonTxt, String key, String value) Function that add new value to JSON mapstatic byte[]
createJsonLoginObj
(byte[] msg, byte tests) Function that return json object represented by jsontext and included single message assigned to "msg" keystatic byte[]
createJsonObj
(byte[] msg) Function that return json object represented by jsontext and included single message assigned to "msg" keystatic 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
-
Constructor Details
-
JSONUtils
public JSONUtils()
-
-
Method Details
-
getSingleMessage
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
Function that return value for given key from json object represented by jsontext- Parameters:
jsonTxt
- {String} JSON objectkey
- {int} key by which value should be obtained from JSON map- Returns:
- {int} obtained value from JSON map
-
addValueToJsonObj
Function that add new value to JSON map- Parameters:
jsonTxt
- {String} JSON objectkey
- {String} key by which value should be assigned to JSON mapvalue
- {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
-