Let a jsonl export keep a record a value
`--format jsonl` existed, but `_cell` ran json.dumps at row-build time, before a format was chosen — so a nested value was a string by then and jsonl only re-escaped it, leaving a consumer against csv's 128KB field limit either way. Stringifying moved to the csv writer, so csv is byte-identical and jsonl carries json. The runs TUI followed, or a record would draw as a Python repr.
This commit is contained in:
@@ -9,6 +9,7 @@ So nothing here computes what a route already knows.
|
||||
|
||||
from __future__ import annotations
|
||||
|
||||
import json
|
||||
from typing import Any
|
||||
|
||||
from rich.text import Text
|
||||
@@ -45,6 +46,10 @@ def _cell(value: Any) -> str:
|
||||
"""
|
||||
if isinstance(value, float):
|
||||
return f"{value:.4g}"
|
||||
if isinstance(value, (dict, list)):
|
||||
# An export keeps a record a value now, and python's repr of one is
|
||||
# not what anybody reading a run wrote down.
|
||||
return json.dumps(value)
|
||||
return "" if value is None else str(value)
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user