fjson-core 0.1.2

fjson is a zero-dependency JSON Parser and Fixer. It takes any input and produces valid JSON. No AI involved.
Documentation
  • Coverage
  • 50%
    1 out of 2 items documented0 out of 1 items with examples
  • Size
  • Source code size: 26.36 kB This is the summed size of all the files inside the crates.io package for this release.
  • Documentation size: 1.21 MB This is the summed size of all files generated by rustdoc for all configured targets
  • Ø build duration
  • this release: 12s Average build duration of successful builds.
  • all releases: 13s Average build duration of successful builds in releases after 2024-10-23.
  • Links
  • matx64/fjson
    5 1 0
  • crates.io
  • Dependencies
  • Versions
  • Owners
  • matx64

fjson

fjson is a zero-dependency JSON Parser and Fixer. It takes any input and produces valid JSON. No AI involved.

Features

  • Deserializes everything by default (root and nested).
  • Repairs incomplete JSON by closing missing brackets and strings.
  • Normalizes boolean and null values (e.g., True → true, FALSE → false).
  • Normalizes numbers (removes trailing zeros, fixes invalid formats).
  • Formatting (beautifier).
  • Zero external dependencies.

Installation

Add to Cargo.toml:

[dependencies]
fjson-core = "0.1"

API

fix(input: impl Into<String>) -> String

Parse and fix JSON input. Returns formatted, valid JSON.

Examples

Basic Usage

fn main() {
    let broken = r#"{ "user" "foo", "age": 0020, }"#;
    let fixed = fjson_core::fix(broken);
    println!("{}", fixed);
}

Output:

{
  "user": "foo",
  "age": 20
}

Truncated Logs

let truncated_log = r#"{"request_id": 123, "status": "success", "data": {"items": [{"id": 1}, {"id": 2}"#;
let fixed = fjson_core::fix(truncated_log);

Nested JSON Deserialization

let nested = r#"{"payload": "{\"user\": \"alice\", \"role\": \"admin\"}"}"#;
let fixed = fjson_core::fix(nested);

Output:

{
  "payload": {
    "user": "alice",
    "role": "admin"
  }
}

Use Cases

  • Truncated logs - Recover valid JSON from log entries that were cut off
  • Minified JSON - Beautify compressed JSON
  • Partial responses - Handle incomplete API responses
  • Data validation - Quick fix for malformed JSON from unreliable sources

License

Copyright © 2025-present, fjson Contributors.

This project is MIT licensed.