Python Highlight specific text in json document on terminal
Question: I am interested in highlighting a specific portion of the json document based
on some arbitrary matching algorithm. For example

    
    
    {
      "text" : "hello world"
    }
    

I searched for "hello" and above json document has hello in it. How to
highlight that particular portion "hello" while displaying the document on the
terminal using python? Also, the json has to be pretty printed.

Expected

    
    
    {
      "text" :  " `hello` world"
    }
    

Text that is qoutes should be displayed in red color.


Answer: I can't comment :(

The answer here might be able to help you: [Print in terminal with colors
using Python?](http://stackoverflow.com/questions/287871/print-in-terminal-
with-colors-using-python)

For example, you could use termcolor (if you are using a linux style terminal)
and replace "hello" with colored("hello", "red")

    
    
    from termcolor import colored
    
    sample_text = "colored hello there !"
    print(sample_text)
    
    print(sample_text.replace("hello", colored("hello", "red")))
    

