Skip to content

Commit f74ae96

Browse files
author
Benjamin Yap
committed
Add a helper function to extract String from JSON object
1 parent aacab2c commit f74ae96

File tree

1 file changed

+11
-0
lines changed

1 file changed

+11
-0
lines changed

src/com/bwyap/utility/resource/JSONWrapper.java

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,17 @@ protected static int getInteger(JSONObject o, String key) {
4040
}
4141

4242

43+
/**
44+
* A helper function for extracting a String value from a JSON object
45+
* @param o
46+
* @param key
47+
* @return
48+
*/
49+
protected static String getString (JSONObject o, String key) {
50+
return o.get(key).toString();
51+
}
52+
53+
4354
/**
4455
* Validates the contents of the loaded JSON object.
4556
* <p>

0 commit comments

Comments
 (0)