jakartaee / jakartaee/jsonp-api
[api] Support x-json-stream, add JsonGenerator writeNewLine()
- Dominant language
- Java
- Stars
- 160
- Forks
- 64
- Avg merge
- 4d 5h
- Merged PRs (30d)
- 4
Description
Reference: https://en.wikipedia.org/wiki/JSON_streaming#Line-delimited_JSON
When looking at JsonGenerator API I do not see a mechanism to support `x-json-stream` type output using the "Line delimited JSON" format. Is there a way to produce it that I am missing? Otherwise, I would like to discuss and see if that would be something we could look to add?
### Background:
I have traditionally been using jackson core JsonGenerator which includes a [writeRaw(char)](https://github.com/FasterXML/jackson-core/blob/2.14/src/main/java/com/fasterxml/jackson/core/JsonGenerator.java#L1435) method that I can use to write the new line character.
In general for `x-json-stream` "line delimited JSON" we need to:
1. Ensuring "pretty" printing JSON is disabled / turned off
2. Write `\n` characters after each top level json object
Ideally I would like to see support for producing this via the JsonGenerator API. I believe that would mean adding a method to JsonGenerator like `writeNewLine()`.
Contributor guide
Research direction
The issue names the JsonGenerator API and references Jackson's JsonGenerator writeRaw(char); start by reviewing the repository's JsonGenerator definition and existing formatting or output tests. Confirm how a writeNewLine() API should interact with pretty printing and top-level values, then define completion as supported line-delimited JSON output with tests covering the behavior.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- java
- Domain
- api
- Issue type
- Feature
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100