1 package com.pentila.entSavoie.utils;
3 import com.liferay.portal.kernel.json.JSONArray;
4 import com.liferay.portal.kernel.json.JSONException;
5 import com.liferay.portal.kernel.json.JSONFactoryUtil;
8 * This class groups all the method to use on JSON object
9 * @author Alexandre Lef
\8fvre
12 public class JSONUtils {
15 * String representing empty JSONa array
17 public static String EMPTY_JSON_ARRAY = "[]";
19 * This method merge Json arrays in parameters
20 * @param arrs ths JSonArray object you want to merge
21 * @return the merged JSONArray
22 * @throws JSONException
24 public static JSONArray concatArray(JSONArray... arrs)
25 throws JSONException {
27 JSONArray result = JSONFactoryUtil.createJSONArray();
29 for (JSONArray arr : arrs) {
30 for (int i = 0; i < arr.length(); i++) {
31 result.put(arr.getJSONObject(i));