Пример получения JSON на JSP
<%@ taglib prefix="json" uri="http://www.atg.com/taglibs/json" %>
<sql:query var="rs" dataSource="jdbc/ORACLE">
SELECT
to_char(r.TIME_STAMP, 'dd.mm.yyyy hh24:mi:ss') AS TIME_STAMP,
r.NAME AS COUNTER,
r.VALUE
FROM
profile_new r
WHERE
TIME_STAMP > to_date('25.07.2016 02:30:00', 'dd.mm.yyyy hh24:mi:ss')
and TIME_STAMP < to_date('25.07.2016 02:35:00', 'dd.mm.yyyy hh24:mi:ss')
order by time_stamp
</sql:query>
<c:set var="json_text" scope="application">
<json:array name="rows" prettyPrint="false">
<c:forEach var="row" items="${rs.rows}">
<json:object>
<json:property name="TIME_STAMP" value="${row.TIME_STAMP}"/>
<json:property name="COUNTER" value="${row.COUNTER}"/>
<json:property name="VALUE" value="${row.VALUE}"/>
</json:object>
</c:forEach>
</json:array>
</c:set>
Пример результата
[{"TIME_STAMP": "2016-07-25 02:30:22", "COUNTER": "COUNT_ALL", "VALUE": 635 }, { "TIME_STAMP": "2016-07-25 02:30:22", "COUNTER": "COUNT_BAD", "VALUE": 1 }, { "TIME_STAMP": "2016-07-25 02:30:22", "COUNTER": "QUALITY", "VALUE": 99.84 }, { "TIME_STAMP": "2016-07-25 02:31:22", "COUNTER": "COUNT_ALL", "VALUE": 642 }, { "TIME_STAMP": "2016-07-25 02:31:22", "COUNTER": "COUNT_BAD", "VALUE": 1 }, { "TIME_STAMP": "2016-07-25 02:31:22", "COUNTER": "QUALITY", "VALUE": 99.84 }]
Отличное преимущество этой "строки" в том, что она легко подвергается демаршалингу.