docker and format json

I’m trying to get usable json from the docker cli, however it seems it will only produce json for individual items, and not the complete result, as a whole.

For example, running docker container ls -a --format="{{ json .Names }}" produces:

"hopeful_payne"
"trusting_turing"
"stupefied_morse"
"unruffled_noyce"
"pensive_fermi"
"objective_neumann"
"confident_bhaskara"
"unruffled_cray"
"epic_newton"
"boring_bartik"
"priceless_sinoussi"
"naughty_grothendieck"
"hardcore_bose"
"sad_jones"
"optimistic_napier"
"trusting_stallman"
"xenodochial_dijkstra"
"pedantic_cocks"

The above is not json.

How can I produce a result that is, ideally, a json array?

Source: StackOverflow