Is there some CLI tool to format Candid responses like how jq does for JSON?

You could use GitHub - dfinity/idl2json to convert candid to json and then use jq.

As for the pretty printing, we stopped pretty printer when the data is too large, due to several reasons:

  1. it’s hard to know a good format for large data. For example, vec { 1;2;3 } .vs. vec {\n 1;\n2;\n3;\n };
  2. The pretty printer we used is unfortunately not linear time, so for large data, it’s not very efficient;
  3. Even with the same type, we may need different format for different cases. For example, both account_id and asset_content can be of type blob, but we may prefer to display account_id in hex, and asset_content as printable ascii. Ideally, we need a way to specify how to pretty print each field.
2 Likes