public class JSONUtils extends Object
| Constructor and Description |
|---|
JSONUtils() |
| 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 |
public static String addValueToJsonObj(String jsonTxt, String key, String value)
jsonTxt - {String} JSON objectkey - {String} key by which value should be assigned to JSON mapvalue - {String} value for given keypublic static byte[] createJsonLoginObj(byte[] msg,
byte tests)msg - {byte[]} message which should be assigned to json objecttests - the testspublic static byte[] createJsonObj(byte[] msg)
msg - {byte[]} message which should be assigned to json objectpublic static String getSingleMessage(String jsonTxt)
jsonTxt - {String} JSON objectpublic static String getValueFromJsonObj(String jsonTxt, String key)
jsonTxt - {String} JSON objectkey - {int} key by which value should be obtained from JSON map