apache / apache/arrow-rs

Is there a way to render pretty json?

Open
#3,418 2 comments 0 reactions 0 assignees View on GitHub
question
Dominant language
Rust
Stars
3.6k
Forks
1.3k
Avg merge
2d 18h
Merged PRs (30d)
169

Description

**Which part is this question about**

generating json using `json::ArrayWriter`

**Describe your question**

is there a way to pretty write JSON data?

i.e.

instead of

```json
[{"foo": "bar", "baz": "zee"}]
```

render

```json
[
{
"foo": "bar",
"baz": "zee"
}
]
```

**Additional context**

This is currently how I'm doing it:

```rust
let mut writer = json::ArrayWriter::new(Vec::new());

writer.write_batches(&batches)?;
writer.finish()?;

return Ok(String::from_utf8(writer.into_inner())?);
```

Contributor guide

Open the contributing guide

Research direction

Start at the `json::ArrayWriter` entry point and inspect its available configuration, documentation, and related JSON-writing code. Determine whether pretty output is already supported or whether the request requires a defined API change; done means the supported behavior or requested scope is documented and covered by an appropriate test.

Written by the indexing model from the issue text.

Assessment

Tech stack
rust
Domain
data
Issue type
Feature
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.