HPCC-12290 Reimplement jarray using templates

Signed-off-by: Gavin Halliday <gavin.halliday@lexisnexis.com>
Previously it linked all the values in the array (line 10402-3 above), and then passed the array on to a function which added them.  Now it just links and adds them in the same function.