Skip to content

Instantly share code, notes, and snippets.

@wertgit
wertgit / JsonConversionUtil.java
Last active March 22, 2016 11:07
JsonConversionUtil
if (matcher.matches()) {
// Handle as array
String fieldName = matcher.group(1);
int index = Integer.parseInt(matcher.group(2));
JSONArray newArrayStep;
if (root.has(fieldName)) {
newArrayStep = root.getJSONArray(fieldName);
} else {
newArrayStep = new JSONArray();
root.put(fieldName, newArrayStep);