Skip to content

michurin/jsonpainter

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

23 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Fuzzy JSON highlighting

build codecov go reference play.golang.org

Description

In fact, it doesn't perform full JSON parsing. It consider spaces, quoted strings, brackets (including brackets balance), colons (in context), commas... In addition, it emphasizes quoted strings right before colons and mark them as keys.

Thanks to this, it can treat semi-JSON strings like this:

12:00:00 INFO Request: {"msg": "hellow"}, Response: {"ok": true}

Demo

JSON painter demo

You can find code of this demo in demo brunch.

You can also play with library online. However, this online sandbox doesn't allow to display colored text. Instead of painted text it you will show you control sequences (ANSI escape codes) as is.

Examples

fmt.Println(paintjson.String(`{"x":12}`))

Install

go get github.com/michurin/jsonpainter

Todo

  • The library gets to have too much heuristics. It has to be rethinking in terms of full-fledged parser.
  • Streaming: obtain io.Reader
  • CLI tool

About

Fuzzy JSON highlighting

Topics

Resources

License

Stars

Watchers

Forks

Languages