The this extra parameter can save bandwidth between the webserver(postgresql/php) and client(javascript).
Now i'm doing it like this:
CREATE FUNCTION to_num_json(_in json) RETURNS json AS $$ DECLARE _pair RECORD; _arr json[]; BEGIN FOR _pair IN SELECT * FROM json_each(_in) LOOP _arr := _arr || _pair.value; END LOOP; RETURN to_json(_arr); END