{{ message }}
Repository navigation
contentviews: add support for displaying NDJSON (#5608) - #8479
Open
johnnylemonny wants to merge 2 commits into
Open
johnnylemonny wants to merge 2 commits into
johnnylemonny wants to merge 2 commits into
Conversation
johnnylemonny
force-pushed
the
feature/ndjson-contentview
branch
from
October 21, 2026 18:38
716f3a7 to
53fc6c2
Compare
This branch has not been deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.

Hi team! 👋 My first contribution to this project!
This PR picks up the feature discussed in old #5608 to support Newline-Delimited JSON (NDJSON) in the existing JSON content view, following the approach suggested by @Prinzhorn and @mhils.
When inspecting Elasticsearch
_bulkpayloads, LLM/streaming responses, or log streams formatted as NDJSON, mitmproxy previously fell back to raw/text view becausejson.loadsfailed on multiple concatenated JSON records.Changes
JSONContentview.prettify, if parsing the whole payload as a single JSON document fails, we now attempt to parse each non-empty line as a distinct JSON object. Each record is formatted with 4-space indentation and joined with newlines.application/x-ndjsonandapplication/ndjson(as well as*ndjsonsubtypes) torender_priorityso NDJSON streams are recognized automatically.ValueErroras before, preserving existing error semantics.## Unreleased: mitmproxy next.Checklist
test/mitmproxy/contentviews/test__view_json.py).uv run pytest test/mitmproxy/contentviews/test__view_json.py- 100% coverage on_view_json.py).uv run ruff check .anduv run mypy).Thanks for reviewing, and thank you for maintaining mitmproxy!