{"id":20723557,"url":"https://github.com/gagan-bansal/munia-pretty-json","last_synced_at":"2025-04-23T17:27:14.130Z","repository":{"id":38246794,"uuid":"415464695","full_name":"gagan-bansal/munia-pretty-json","owner":"gagan-bansal","description":"Convert the JSON log into readable form with command line.","archived":false,"fork":false,"pushed_at":"2022-06-08T09:11:49.000Z","size":621,"stargazers_count":13,"open_issues_count":1,"forks_count":3,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-04-14T13:57:10.053Z","etag":null,"topics":["formatter","javascript","json","log","nodejs","table","viewer","winston"],"latest_commit_sha":null,"homepage":"","language":"JavaScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/gagan-bansal.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2021-10-10T02:08:39.000Z","updated_at":"2025-02-18T13:00:03.000Z","dependencies_parsed_at":"2022-08-28T21:11:09.734Z","dependency_job_id":null,"html_url":"https://github.com/gagan-bansal/munia-pretty-json","commit_stats":null,"previous_names":[],"tags_count":12,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/gagan-bansal%2Fmunia-pretty-json","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/gagan-bansal%2Fmunia-pretty-json/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/gagan-bansal%2Fmunia-pretty-json/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/gagan-bansal%2Fmunia-pretty-json/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/gagan-bansal","download_url":"https://codeload.github.com/gagan-bansal/munia-pretty-json/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":250479551,"owners_count":21437384,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["formatter","javascript","json","log","nodejs","table","viewer","winston"],"created_at":"2024-11-17T04:09:05.637Z","updated_at":"2025-04-23T17:27:14.076Z","avatar_url":"https://github.com/gagan-bansal.png","language":"JavaScript","funding_links":[],"categories":["javascript"],"sub_categories":[],"readme":"## munia-pretty-json\n\nConvert the JSON log into readable form with command line. JSON logs can also be viewed as gird/table form on console.\n\n### Installation\n\n```sh\nnpm install -g munia-pretty-json\n```\n\n### Example\n\nJSON log records (app-log.json):\n\n```\n{\"time\":\"2021-06-09T02:50:22Z\",\"level\":\"info\",\"message\":\"Log for pretty JSON\",\"module\":\"init\",\"hostip\":\"192.168.0.138\",\"pid\":123}\n{\"time\":\"2021-06-09T03:27:43Z\",\"level\":\"warn\",\"message\":\"Here is warning message\",\"module\":\"send-message\",\"hostip\":\"192.168.0.138\",\"pid\":123}\n```\n\nRun the commond **munia-pretty-json** on shell:\n\n```sh\n$ munia-pretty-json app-log.json\n```\n\nThis turns the JSON to:\n\n![output](output1.png)\n\n\nWith this tool the main feature is **template** that prettifies easily the JSON. Here is an example of template:\n\n```sh\n$ munia-pretty-json  --template  '{module --color} - {level} - {message}'  app-log.json\n```\n\n![output](output2.png)\n\n\n\n### Usage\n\n\u003cpre\u003e\n  Usage: munia-pretty-json [options] \u0026lt;json-file\u0026gt;\n         tail -f \u0026lt;json-file\u0026gt; | munia-pretty-json [options]\n         node myapp.js | munia-pretty-json [options]\n\n  Options:\n\n    -t, --template ..... template to format the json record\n                         '{key [options]} {key [options]} {...}'\n                         json property (key) names are used to format the template\n                         default template '{time} {level --color} {message}'\n    -C, --context ...... print number of lines before and after context\n    -a, --all .......... print formatted json and non json records if true, default true\n                         print only formatted json if false\n        --error-key .... print full value of error key, default true\n        --cache ........ read/write arguments from/to cache file './.mpjrc', default true\n    -g, --grid ......... grid/table view, default false\n    -d, --debug ........ print json parsing error message, default false\n    -h, --help ......... help/usage infromation\n    -v, --version ...... version of this app\n\n  template options:\n\n    -c, --color ........ color the values of this key, default false\n    -i, --include ...... include records which match the value of key\n    -e, --exclude ...... exclude records which match the value of key\n    -f, --filter ....... regular expression to filter the records\n    -s, --span ......... span as number of characters for the column widh\n                         in grid/table view\n    -w, --width ........ width of string to be printed\n                         if negative then width is considered backward\n    --level-key ........ log level key, default 'level',\n                         effective only when used with --color option\n                         it is useful to select defualt colors for levels\n\n  template special options for specific options:\n\n    -l, --level ........ level value, level upto which records to be included,\n                         default 'info'\n                         --level=info is equivenlent to --include=error,warn,info\n                         Note: option only related to level key\n    -t, --time ......... format the time key value from milli seconds to string\n                         optional tokens can also be given to format the time\n                         example: -t '[YYYYescape] YYYY-MM-DDTHH:mm:ssZ[Z]'\n                         tokens as per dayjs https://day.js.org/docs/en/display/format\n                         Note: option only related to time key\n\n  template special keys:\n\n    REST ............... print rest of the keys and values as a JSON string\n                         (keys which are not part of the template)\n                         example: -t '{level}: {message} {REST}'\n    --include-keys ..... keys to include in 'REST'\n                         example: -t '{msg} {REST --include-keys=app,pid}'\n                         Note: option only related to 'REST' key\n    --exclude-keys ..... keys to exclude from 'REST'\n                         example: -t '{msg} {REST --exclude-keys=host,version}'\n                         Note: option only related to 'REST' key\n\n\u003c/pre\u003e\n\n## Testing\n```shell\nnpm test\n```\n## License\n\nLicensed under [MIT](./LICENSE).\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fgagan-bansal%2Fmunia-pretty-json","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fgagan-bansal%2Fmunia-pretty-json","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fgagan-bansal%2Fmunia-pretty-json/lists"}