Skip to content

Better JSON3.write representation #160

@LilithHafner

Description

@LilithHafner

Right now, JSON3.write stores

julia> JSON3.write(stdout, @be sleep(.01));
{"samples":[{"evals":1.0,"time":0.011088246000000001,"allocs":4.0,"bytes":112.0,"gc_fraction":0.0,"compile_fraction":0.0,"recompile_fraction":0.0,"warmup":1.0},{"evals":1.0,"time":0.011092579,"allocs":4.0,"bytes":112.0,"gc_fraction":0.0,"compile_fraction":0.0,"recompile_fraction":0.0,"warmup":1.0},{"evals":1.0,"time":0.011094829,"allocs":4.0,"bytes":112.0,"gc_fraction":0.0,"compile_fraction":0.0,"recompile_fraction":0.0,"warmup":1.0},{"evals":1.0,"time":0.011086371000000001,"allocs":4.0,"bytes":112.0,"gc_fraction":0.0,"compile_fraction":0.0,"recompile_fraction":0.0,"warmup":1.0},{"evals":1.0,"time":0.011106663000000001,"allocs":4.0,"bytes":112.0,"gc_fraction":0.0,"compile_fraction":0.0,"recompile_fraction":0.0,"warmup":1.0},{"evals":1.0,"time":0.011090704,"allocs":4.0,"bytes":112.0,"gc_fraction":0.0,"compile_fraction":0.0,"recompile_fraction":0.0,"warmup":1.0},{"evals":1.0,"time":0.011087704,"allocs":4.0,"bytes":112.0,"gc_fraction":0.0,"compile_fraction":0.0,"recompile_fraction":0.0,"warmup":1.0},{"evals":1.0,"time":0.011086996,"allocs":4.0,"bytes":112.0,"gc_fraction":0.0,"compile_fraction":0.0,"recompile_fraction":0.0,"warmup":1.0},{"evals":1.0,"time":0.011083413,"allocs":4.0,"bytes":112.0,"gc_fraction":0.0,"compile_fraction":0.0,"recompile_fraction":0.0,"warmup":1.0},{"evals":1.0,"time":0.011085288,"allocs":4.0,"bytes":112.0,"gc_fraction":0.0,"compile_fraction":0.0,"recompile_fraction":0.0,"warmup":1.0}]}

I'd prefer

julia> JSON3.write(stdout, @be sleep(.01));
{"evals":1.0,"time":[0.011088246000000001,0.011092579,0.011094829,0.011086371000000001,0.011106663000000001,0.011090704,0.011087704,0.011086996,0.011083413,0.011085288],"allocs":4.0,"bytes":112.0,"gc_fraction":0.0,"compile_fraction":0.0,"recompile_fraction":0.0,"warmup":1.0}

This would involve a StructTypes package extension

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions