Method returning JSON "empty:false" although this JSON has data

Spring boot uses jackson as default serializer and you're trying to return JSONObject itself. Jackson does not know how to serialize it.

If you want to return dynamic json you can use Map as below :

@GetMapping("/pgTabelka")
public Map<String, Object> pgTable(HttpServletRequest request)
{
    Map<String, Object> json = new HashMap();

    int draw = 0;
    int start = 0;
    int length = 10;

    if(request.getParameter("draw")!=null)
        draw = Integer.parseInt(request.getParameter("draw"));
    if(request.getParameter("start")!=null)
        start = Integer.parseInt(request.getParameter("start"));
    if(request.getParameter("length")!=null)
        length = Integer.parseInt(request.getParameter("length"));
    int totalRecords = sed.recordsTotal();

    List<Seria> serie = sed.findPart(start, length);

    json.put("draw", ++draw);
    json.put("recordsTotal", totalRecords);
    json.put("recordsFiltered", totalRecords);
    json.put("data", serie);

    return json;
}

Or you can create a class represents your json structure and return your custom data class as your response, spring will handle the rest for you.

@GetMapping("/pgTabelka")
public YourJsonDataClass pgTable(HttpServletRequest request)
{
    ...

    YourJsonDataClass json = new YourJsonDataClass();
    json.setDraw(++draw);
    json.setRecordsTotal(totalRecords);
    json.setRecordsFiltered(totalRecords);
    json.setData(serie);

    return json;
}

Use HashMap instead of using JSONObject

List<HashMap<String, String>> myList = new ArrayList<HashMap<String, String>>();

HashMap<String, String> map = new HashMap<>();

map.put(key, value);

myList.add(map);

If you have a ResultSet, you can loop this code thru the rs. It is worth noting that if your HashMap has duplicate keys, you will have to use a Multimap since HashMap doesn't allow duplicate Keys

Multimap<String, String> map = ArrayListMultimap.create();
map.put(key1, "value1");
map.put(key1, "value2");
map.put(key2, "value3");