Watch a JSON file and see updates live

0

I'm trying to monitor a JSON file a program uses as logger. The file changes multiple times a second, and I'd like to keep an eye on how the values evolve over time.

What I've tried so far:

  • jq and jid do not reload when a file changes, even using watch
  • watch -n 0.1 -d 'cat test.json | python -m json.tool' can reload the file correctly, but it cannot be queried or scrolled
  • Text editors acknowledge the changes, but either require a prompt to take them or reset the scroll position on reload

MLProgrammer-CiM

Posted 2018-03-31T02:57:37.607

Reputation: 153

tail -f doesn't help? You can filter output with sed or other. – Paulo – 2018-03-31T17:11:05.733

Is it feasible to adjust your program to save a fresh copy every time the JSON file changes? This would only be in ‘debug’ mode,... – Scot – 2018-04-02T05:31:06.397

No, JSON updates tens of times a second. – MLProgrammer-CiM – 2018-04-03T02:57:28.570

No answers