Skip to main content

Module json

Module json 

Source
Expand description

JSON output formatting for magic rule evaluation results

This module provides JSON-specific data structures and formatting functions for outputting magic rule evaluation results in a structured format compatible with the original libmagic specification.

The JSON output format follows the original spec with fields for text, offset, value, tags, and score, providing a machine-readable alternative to the human-readable text output format.

Structs§

JsonLineOutput
JSON Lines output structure with filename and matches
JsonMatchResult
JSON representation of a magic rule match result
JsonOutput
JSON output structure containing an array of matches

Functions§

format_json_line_output
Format match results as JSON Lines output string
format_json_output
Format match results as JSON output string
format_json_output_compact
Format match results as compact JSON output string
format_value_as_hex
Format a Value as a hexadecimal string for JSON output