JSON.jl icon indicating copy to clipboard operation
JSON.jl copied to clipboard

Make `indent` a keyword argument?

Open TotalVerb opened this issue 8 years ago • 3 comments

Currently, indent is a positional argument for json and print. Personally I think it would read better as a keyword argument:

json(Dict("a" => "b"), 4)

vs.

json(Dict("a" => "b"), indent=4)

TotalVerb avatar Apr 12 '17 19:04 TotalVerb

I think that makes sense. I think this interface with possibly created before keyword arguments existed. There's always the concern that keyword arguments don't participate in dispatch but I'm not sure how much of a concern that is here.

kmsquire avatar Apr 13 '17 03:04 kmsquire

Also document it in the README, I figured out how to pretty print by reading the tests.

ggggggggg avatar Dec 15 '17 18:12 ggggggggg

I would be very supportive of doing this - it confused me for a little bit; using a keyword argument seems far more natural in this interface

graeme-a-stewart avatar Jun 28 '23 07:06 graeme-a-stewart