Skip to main content

OpenSearch NDJSON Unpacker

Project description

OpenSearch NDJSON Unpacker

OpenSearch Dashboards (OSD) allows to export "saved objects" (most notably dashboards, visualizations, and index patterns) as .ndjson files. There are a few aspects that make these hard to read / process:

  • .ndjson (newline-delimited JSON objects) is slightly less common than JSON itself, and not every formatter may be able to work with it.

  • Normal JSON formatting would introduce newlines, and although the JSON data would still be unambiguously parsable, NDJSON parsers may assume that each line is exactly one complete JSON object.

  • Furthermore, OSD has a few values in the JSON data that are itself string-encoded JSON data. In fact, much of the "interesting" values that I want to modify in exported data are inside such JSON strings, which are particularly hard to read and edit since they are not formatted by JSON formatting and contain lots of extra quoting characters.

As a solution to these problems, I wrote this quick script to "unpack" the NDJSON into properly formatted JSON files, including an extraction of the nested JSON strings.

The result can be version-controlled (with readable diffs after changes), possibly edited by hand, and eventually uploaded again using the "ndjson-repack" script that recreates a proper NDJSON file from a directory with unpacked JSON files.

TODOs

  • support exporting only a single dashboard (instead of all dashboards / objects of the same type)

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

ndjson_manip-1.0.0.tar.gz (9.6 kB view details)

Uploaded Source

File details

Details for the file ndjson_manip-1.0.0.tar.gz.

File metadata

  • Download URL: ndjson_manip-1.0.0.tar.gz
  • Upload date:
  • Size: 9.6 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.13.9

File hashes

Hashes for ndjson_manip-1.0.0.tar.gz
Algorithm Hash digest
SHA256 2324fc14c9662f54d8283f68c79bd228c74199e3b28a0307d16342a67445dc6c
MD5 00ea6859447c8c49d1a146c4f60989d3
BLAKE2b-256 115e70131d55ac22cbba682ad2cf4f69089b799296d1c92e815660bce507de21

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page