charmbracelet/lipgloss

Render table to JSON

decentral1se opened this issue · 1 comments

Is your feature request related to a problem? Please describe.

I want to render my lipgloss.Table as JSON.

Describe the solution you'd like

Guessing at an API surface: lipgloss.Table.ToJSON()

Describe alternatives you've considered

Gather results separately from the lipgloss.Table and render myself. There is currently no way to get the raw data you put into lipgloss.Table via Header/Row(s) back out again. So you need to do additional bookkeeping to render stuff later on.

Additional context

A sub-request is probably an API surface to retrieve the data that you put in without additional bookkeeping (e.g. GetHeaders()) 🙃 In the case you don't want to implement a full JSON rendering API surface.