If you know that no filename contains newlines, use jq:
ls | jq -R -s -c 'split("\n")[:-1]'
Short explanation of the flags to jq:
-Rtreats the input as string instead of JSON-sjoins all lines into an array-ccreates a compact output[:-1]removes the last empty string in the output array
This requires version 1.4 or later of jq. Try this if it doesn’t work for you:
ls | jq -R '[.]' | jq -s -c 'add'