JSONUtils.java [src/m/utils] Revision: default  Date:
/*
 * To change this license header, choose License Headers in Project Properties.
 * To change this template file, choose Tools | Templates
 * and open the template in the editor.
 */
package m.utils;

import csip.api.server.ServiceException;
import java.util.ArrayList;
import java.util.List;
import org.codehaus.jettison.json.JSONArray;
import org.codehaus.jettison.json.JSONException;

/**
 *
 * @author ktraff
 */
public class JSONUtils {
    
    
    public static ArrayList<String> toStringArrayList(JSONArray jsonArray) throws ServiceException {
        try {
            ArrayList<String> list = new ArrayList<String>();
            for (int i=0; i<jsonArray.length(); i++) {
                list.add(jsonArray.getString(i));
            }
            return list;
        } catch (JSONException e) {
            throw new csip.api.server.ServiceException(e);  
        }
    }
    
}