All Projects → Javascipt → Jsome

Javascipt / Jsome

Licence: mit
✨ Make your JSON look AWESOME

Programming Languages

javascript
184084 projects - #8 most used programming language

Projects that are alternatives of or similar to Jsome

Zoya
Truly highly composable logging utility
Stars: ✭ 116 (-35.2%)
Mutual labels:  json, color, colors
Saw
Fast, multi-purpose tool for AWS CloudWatch Logs
Stars: ✭ 1,071 (+498.32%)
Mutual labels:  json, color
Color.js
Extract colors from an image (0.75 KB) 🎨
Stars: ✭ 42 (-76.54%)
Mutual labels:  color, colors
Colorjson
Fast Color JSON Marshaller + Pretty Printer for Golang
Stars: ✭ 71 (-60.34%)
Mutual labels:  json, color
Leetheme
优雅的主题管理库- 一行代码完成多样式切换
Stars: ✭ 762 (+325.7%)
Mutual labels:  json, color
Leonardo
Generate colors based on a desired contrast ratio
Stars: ✭ 973 (+443.58%)
Mutual labels:  color, colors
Colorschemes.jl
colorschemes, colormaps, gradients, and palettes
Stars: ✭ 55 (-69.27%)
Mutual labels:  color, colors
colortest
Quickly show all your terminal colors
Stars: ✭ 66 (-63.13%)
Mutual labels:  color, colors
Color Names
Large list of handpicked color names 🌈
Stars: ✭ 1,198 (+569.27%)
Mutual labels:  color, colors
Nord Hyper
An arctic, north-bluish clean and elegant Hyper theme plugin.
Stars: ✭ 96 (-46.37%)
Mutual labels:  color, colors
Values.js
🍇 Get the tints and shades of a color
Stars: ✭ 97 (-45.81%)
Mutual labels:  color, colors
Colorpicker
jQuery UI widget for color picking (similar to the one in Microsoft Office 2010).
Stars: ✭ 271 (+51.4%)
Mutual labels:  color, colors
color-description
Color-Description turns a technical color representation into a human readable description.
Stars: ✭ 18 (-89.94%)
Mutual labels:  color, colors
Pretty Print Json
🦋 Pretty-print JSON data into HTML to indent and colorize (written in TypeScript)
Stars: ✭ 41 (-77.09%)
Mutual labels:  json, color
Colorwaver
🎨 An app to detect color palettes in the real world - powered by VisionCamera
Stars: ✭ 365 (+103.91%)
Mutual labels:  color, colors
Materialdesigncolor
This project shows the color in material design
Stars: ✭ 55 (-69.27%)
Mutual labels:  color, colors
line
An easy to use golang package for stylizing terminal output
Stars: ✭ 26 (-85.47%)
Mutual labels:  color, colors
tasarimcilar-ve-yazilimcilar-icin-kaynak-arsivim
Tasarım ve yazılım ile ilgili 2017 yılından günümüze kadar geçen zamanda toplamış olduğum arşivimi sizle ile paylaşıyorum. Ne mi var her şey...
Stars: ✭ 276 (+54.19%)
Mutual labels:  color, colors
Colors
List of 256 color codes for Xterm including an example of the color, Xterm Name, Xterm Number, HEX, RGB and HSL code.
Stars: ✭ 73 (-59.22%)
Mutual labels:  color, colors
Console Logging
Better, prettier commandline logging for Python--with colors! 👻
Stars: ✭ 111 (-37.99%)
Mutual labels:  color, colors

Make your JSON objects look AWESOME!

Jsome Jsome Jsome

Downloads stats

Jsome

This package allows you to give style to your JSON on your console!

Installation :

  $ npm install jsome

if you need to use jsome as a command line, you may need to instal it globally

  $ [sudo] npm install -g jsome

How does it work ?

Command line :

Using jsome as a command line, you need to run the following command that takes the path to your json file as argument

  $ jsome /path/to/your/json/file.json
  $ jsome [options] /path/to/your/json/file.json

You can also send a json string through a pipe (|)

  $ cat /path/to/your/json/file.json | jsome

The options available are :

  • -c: to enable or disable colors (defualt value: true)
  • -l: to enable or disable levels (default value: false)
  • -s: to specify the number of tabulation spaces (default value: 2)
  • -r: to specify valid JSON as output (default value: true)

examples :

  $ jsome -c false /path/to/your/file.json
  $ jsome -c false -l true /path/to/your/file.json
  $ jsome -s 4 /path/to/your/file.json
Module :

On your nodejs application, when you need to console.log a json object, all you need to do is to use the jsome function

    var jsome = require('jsome');
    jsome([{"id":1,"email":"[email protected]","active":true},{"id":2,"email":"[email protected]","active":false},{"id":3,"email":"[email protected]","active":true}]);

Then your json object will be displayed on the console in a pretty format with Awsome colors ! Here is the result :

jsome

The jsome function returns the object passed as argument so that when debugging, you can print the value of an object without having to change a lot on your code

    // instead of 
    
    var foo = {
      bar : obj
    }
    jsome (obj);
    
    // you can do this :
    
    var foo = {
      bar : jsome(obj)
    }
    

You can add some points to show levels of elements... very helpful when you are dealing with complex json objects

    jsome.level.show = true;

jsome

The object jsome.level has as default value the following json :

  jsome.level = {
      'show'    : false
    , 'char'    : '.'
    , 'color'   : 'red'
    , 'spaces'  : 2
    , 'start'   : 0
  }

You can change the level char, its color ( see chalk package ) and the number of spaces for each level.

You can also display your json starting from a specific level to avoid displaying your json starting from the extreme left. You can do that by changing the value jsome.level.start.

You can configure the colors of the displayed json by changing the values of the jsome.colors object which has as default these values.

  jsome.colors = {
      'num'   : 'cyan'    // stands for numbers
    , 'str'   : 'magenta' // stands for strings
    , 'bool'  : 'red'     // stands for booleans
    , 'regex' : 'blue'    // stands for regular expressions
    , 'undef' : 'grey'    // stands for undefined
    , 'null'  : 'grey'    // stands for null
    , 'attr'  : 'green'   // objects attributes -> { attr : value }
    , 'quot'  : 'yellow'  // strings quotes -> "..."
    , 'punc'  : 'yellow'  // commas seperating arrays and objects values -> [ , , , ]
    , 'brack' : 'yellow'  // for both {} and []
  }

You can not only use the color value as string but also you can use an array to specify the background color or you can make things look bold ( see chalk package for more details )

  jsome.colors.bool  = ['green' , 'bgRed']
  jsome.colors.attr  = ['green' , 'bold']
  jsome.colors.quot  = ['yellow', 'bold']
  jsome.colors.punc  = ['yellow', 'bold']
  jsome.colors.brack = ['yellow', 'bold']

jsome

When you have a json as a string, instead of passing by JSON.parse function, you can just call the parse function of jsome

  jsome(JSON.parse('[1,2,3]'));

becomes:

  jsome.parse('[1,2,3]');

If you need to disable the colors:

  jsome.params.colored = false;

If you need JSON which pases linting:

  jsome.params.lintable = true;

When you have a very long json to display, don't make your code blocking... you can enable the asynchronous mode.

  jsome.params.async = true;

  jsome(longJson, function () {
      /* Your code here */
  });

The default value of params is:

  jsome.params = {
      'colored' : true
    , 'async'   : false
    , 'lintable': false
  }

In order to get the colored string without printing it on the console :

   var coloredString = jsome.getColoredString(obj)
Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].