package org.sillyjirafe.api;

import java.util.List;

import org.json.JSONArray;
import org.json.JSONObject;
import org.sillyjirafe.uoapi.element;

public class Json {
	public static String JSONConvert(List<element> elements) {
	    JSONArray tableau = new JSONArray();

	    for (element e : elements) {
	        JSONObject obj = new JSONObject();
	        obj.put("title", e.title());
	        obj.put("url", e.url());
	        obj.put("licence", e.licence());
	        obj.put("source", e.source());
	        obj.put("type", e.type());
	        tableau.put(obj);
	    }

	    return tableau.toString();
	}
}
