mpv-player / mpv-player/mpv

Lua function to pretty print JSON, perhaps an optional arg for utils.format_json()?

Open
#17,241 0 comments 1 reaction 0 assignees View on GitHub

Nobody has claimed this yet.

meta:feature-request
Dominant language
C
Stars
37k
Forks
3.5k
Avg merge
1d 10h
Merged PRs (30d)
22

Description

Expected behavior of the wanted feature

I'm pretty printing JSON to a file using dkjson since MPV doesn't have a built-in function for it. Example:

{
  "video name":{
    "firstwatched":1767796909,
    "endtime":"5.528",
    "lastwatched":1767796909,
    "starttime":"0",
    "watchcount":1
  }
}

A function would be nice so I wouldn't need a module (just 1) in my script. Perhaps an optional 2nd arg could be added to utils.format_json(): a bool for if it should be pretty printed.

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start with the documented utils.format_json() API and locate its current implementation and related tests. Determine how an optional pretty-print argument should affect the generated JSON while preserving existing behavior; done means callers can request readable indentation without requiring dkjson.

Written by the indexing model from the issue text.

Assessment

Tech stack
lua
Domain
api, cli
Issue type
Feature
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
45/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.