otp icon indicating copy to clipboard operation
otp copied to clipboard

Add a formatter to json

Open dgud opened this issue 1 year ago • 4 comments

To aid debugging or storing a readable file, some sort of formatter is needed.

@michalmuskala

dgud avatar May 27 '24 05:05 dgud

CT Test Results

    2 files     95 suites   35m 54s :stopwatch: 2 145 tests 2 097 :white_check_mark: 48 :zzz: 0 :x: 2 454 runs  2 404 :white_check_mark: 50 :zzz: 0 :x:

Results for commit 17cbbf82.

:recycle: This comment has been updated with latest results.

To speed up review, make sure that you have read Contributing to Erlang/OTP and that all checks pass.

See the TESTING and DEVELOPMENT HowTo guides for details about how to run test locally.

Artifacts

// Erlang/OTP Github Action Bot

github-actions[bot] avatar May 27 '24 05:05 github-actions[bot]

We often use ~0p when printing terms during debugging. This because the indent can greatly increase data size and kill performance (or the node). An equivalent for the JSON formatter would be appreciated. We can always pretty print it in an editor or on the command line later on if necessary.

essen avatar May 27 '24 07:05 essen

The default encode/[1,2] already does that, i.e. creates a "string" without adding any whitespace characters?

This is a 50% slower and (memory consuming) variant for when you want print it formatted in the shell or file. Or do I not understand your comment?

dgud avatar May 27 '24 07:05 dgud

My bad I must not have completely woke up today. Please disregard my comment!

essen avatar May 27 '24 08:05 essen