package Util;

import java.util.Map;

import javax.servlet.http.HttpServletRequest;

import org.json.simple.JSONObject;

public class JSONUtil {
	public static JSONObject HttpRequest2JSON(final HttpServletRequest req)
	{
		JSONObject json = new JSONObject();
		Map<String, String[]> map = req.getParameterMap();
		for(Map.Entry<String, String[]> entry : map.entrySet())
		{
			String[] val = entry.getValue();
			if(val != null)
			{
				json.put(entry.getKey(), val[0]);
			}
		}
		return json;
	}
}
