Skip to main content

High-performance Python bindings for JSON flattening, path type analysis, and schema generation

Project description

cJSON-Tools

CI Security Performance PyPI Python License Downloads Documentation

A high-performance C toolkit for transforming and analyzing JSON data with Python bindings. cJSON-Tools provides powerful tools for:

  1. JSON Flattening: Converts nested JSON structures into flat key-value pairs
  2. Path Type Analysis: Get flattened paths with their data types for schema discovery
  3. JSON Schema Generation: Analyzes JSON objects and generates a unified JSON schema
  4. JSON Filtering: Remove keys with empty string values or null values
  5. Regex Key Replacement: Replace JSON keys matching regex patterns
  6. Regex Value Replacement: Replace JSON string values matching regex patterns
  7. Multi-threading Support: Optimized performance for processing large JSON datasets
  8. Performance Optimized: SIMD instructions, memory pools, and cache-friendly algorithms
  9. Python Bindings: Use the library directly from Python with native C performance

🚀 Quick Start

Python (Recommended)

pip install cjson-tools
import cjson_tools
import json

# Flatten nested JSON
data = {"user": {"name": "John", "address": {"city": "NYC"}, "tags": ["dev", "python"]}}
flattened = cjson_tools.flatten_json(json.dumps(data))
print(flattened)  # {"user.name": "John", "user.address.city": "NYC", "user.tags[0]": "dev", "user.tags[1]": "python"}

# Get flattened paths with data types
paths_with_types = cjson_tools.get_flattened_paths_with_types(json.dumps(data))
print(paths_with_types)  # {"user.name": "string", "user.address.city": "string", "user.tags[0]": "string", "user.tags[1]": "string"}

# Generate JSON schema
schema = cjson_tools.generate_schema(json.dumps(data))
print(schema)

# Remove keys with empty string values
data_with_empty = {"name": "John", "email": "", "phone": "123-456-7890", "bio": ""}
cleaned = cjson_tools.remove_empty_strings(json.dumps(data_with_empty))
print(cleaned)  # {"name": "John", "phone": "123-456-7890"}

# Remove keys with null values
data_with_nulls = {"name": "John", "email": None, "phone": "123-456-7890", "address": None}
filtered = cjson_tools.remove_nulls(json.dumps(data_with_nulls))
print(filtered)  # {"name": "John", "phone": "123-456-7890"}

# Replace keys matching regex patterns
data_with_sessions = {"session.pageTimesInMs.HomePage": 1500, "session.pageTimesInMs.AboutPage": 2000, "user.name": "John"}
replaced_keys = cjson_tools.replace_keys(json.dumps(data_with_sessions), r"^session\.pageTimesInMs\..*$", "session.pageTimesInMs.PrezzePage")
print(replaced_keys)  # {"session.pageTimesInMs.PrezzePage": 1500, "session.pageTimesInMs.PrezzePage": 2000, "user.name": "John"}

# Replace string values matching regex patterns
data_with_old_values = {"user": {"status": "old_active", "role": "old_admin", "name": "John"}}
replaced_values = cjson_tools.replace_values(json.dumps(data_with_old_values), r"^old_.*$", "new_value")
print(replaced_values)  # {"user": {"status": "new_value", "role": "new_value", "name": "John"}}

C Library

git clone https://github.com/amaye15/cJSON-Tools.git
cd cJSON-Tools
make
./bin/json_tools -f input.json

📁 Project Structure

  • c-lib/ - C library source code, headers, and tests
    • src/ - C source files with optimized algorithms
    • include/ - C header files
    • tests/ - Dynamic test suite and benchmarks
  • py-lib/ - Python bindings and related files
    • cjson_tools/ - Python package source
    • tests/ - Python unit tests
    • examples/ - Python usage examples
    • benchmarks/ - Performance testing scripts

✨ Features

🔄 JSON Flattening

  • Dot Notation: Nested objects → address.city
  • Array Indexing: Arrays → skills[0], skills[1]
  • Type Preservation: Maintains strings, numbers, booleans, null
  • Deep Nesting: Handles arbitrarily nested structures
  • Batch Processing: Process thousands of objects efficiently

📋 JSON Schema Generation

  • JSON Schema Draft-07: Standards-compliant schema generation
  • Smart Type Detection: Handles nested objects, arrays, mixed types
  • Required Properties: Automatically detects required vs optional fields
  • Nullable Support: Identifies fields that can be null
  • Array Analysis: Intelligent sampling for large arrays

🧹 JSON Filtering

  • Remove Empty Strings: Filter out keys with empty string ("") values
  • Remove Null Values: Filter out keys with null values
  • Recursive Processing: Works on deeply nested objects and arrays
  • Structure Preservation: Maintains JSON structure while filtering
  • Pretty Printing: Optional formatted output for filtered results

🔄 Regex Replacement

  • Replace Keys: Use regex patterns to replace JSON keys matching specific patterns
  • Replace Values: Use regex patterns to replace JSON string values matching patterns
  • POSIX Regex Support: Full regex functionality on Unix-like systems (Linux, macOS)
  • Type Safety: Value replacement only affects string values, preserves numbers/booleans/null
  • Recursive Processing: Works on deeply nested objects and arrays
  • Pattern Flexibility: Support for complex regex patterns with capture groups and anchors

⚡ Performance Optimizations

  • Multi-threading: Parallel processing for large datasets
  • Memory Pools: Optimized memory allocation for small strings
  • Branch Prediction: Compiler hints for better CPU performance
  • Adaptive Threading: Automatically chooses optimal thread count
  • SIMD Optimizations: Vectorized operations where possible
  • Zero-Copy: Minimal memory copying for better performance

🐍 Python Integration

  • Native Performance: C-speed with Python convenience
  • Pythonic API: Simple, intuitive function calls
  • Type Safety: Proper error handling and validation
  • Memory Management: Automatic cleanup, no memory leaks

📋 Requirements

Python Package (Recommended)

  • Python: 3.6+ (3.8+ recommended)
  • Compiler: Automatically handled by pip
  • Platform: Linux, macOS, Windows

C Library Development

  • Compiler: GCC 7+ or Clang 6+ with C99 support
  • Dependencies: Integrated cJSON (no external dependencies)
  • Threading: POSIX threads (pthread)
  • Build Tools: Make, standard build utilities

Platform-Specific Setup

Ubuntu/Debian

sudo apt-get update
sudo apt-get install build-essential python3-dev

macOS

# Install Xcode Command Line Tools
xcode-select --install
# Or install via Homebrew
brew install python

Windows

  • Install Visual Studio Build Tools or Visual Studio Community
  • Python will automatically detect and use the compiler

🛠️ Installation & Setup

Option 1: Python Package (Recommended)

From PyPI

pip install cjson-tools

From Source

git clone https://github.com/amaye15/cJSON-Tools.git
cd cJSON-Tools/py-lib
pip install -e .  # Development mode
# or
pip install .     # Regular installation

Option 2: C Library Development

Quick Build

git clone https://github.com/amaye15/cJSON-Tools.git
cd cJSON-Tools
make                    # Build optimized version
make debug             # Build debug version

Advanced Build Options

# Clean build
make clean && make

# Install system-wide (optional)
sudo make install

# Build with specific optimizations
CFLAGS="-O3 -march=native" make

# Build tests
cd c-lib/tests
make

Option 3: Development Setup

Full Development Environment

# Clone repository
git clone https://github.com/amaye15/cJSON-Tools.git
cd cJSON-Tools

# Build C library
make

# Setup Python development
cd py-lib
python3 -m venv venv
source venv/bin/activate  # On Windows: venv\Scripts\activate
pip install -e .

# Run tests
python3 tests/test_cjson_tools.py
cd ../c-lib/tests
./run_dynamic_tests.sh

🚀 Usage Guide

Python API (Recommended)

Basic Operations

import cjson_tools
import json

# Single object flattening
data = {"user": {"name": "John", "details": {"age": 30, "city": "NYC"}}}
flattened = cjson_tools.flatten_json(json.dumps(data))
result = json.loads(flattened)
print(result)  # {"user.name": "John", "user.details.age": 30, "user.details.city": "NYC"}

# Schema generation
schema = cjson_tools.generate_schema(json.dumps(data))
schema_obj = json.loads(schema)
print(schema_obj["properties"])

Path Type Analysis

# Get flattened paths with their data types
data = {
    "user": {
        "name": "John",
        "age": 30,
        "tags": ["developer", "python"],
        "address": {
            "coordinates": [40.7128, -74.0060],
            "city": "New York"
        },
        "active": True,
        "metadata": None
    }
}

# Analyze path types
paths_with_types = cjson_tools.get_flattened_paths_with_types(json.dumps(data))
result = json.loads(paths_with_types)

# Output shows each flattened path with its data type:
# {
#   "user.name": "string",
#   "user.age": "integer",
#   "user.tags[0]": "string",
#   "user.tags[1]": "string",
#   "user.address.coordinates[0]": "number",
#   "user.address.coordinates[1]": "number",
#   "user.address.city": "string",
#   "user.active": "boolean",
#   "user.metadata": "null"
# }

# Perfect for data analysis and schema discovery!
for path, data_type in result.items():
    print(f'"{path}": "{data_type}"')

Batch Processing

# Process multiple objects efficiently
objects = [
    '{"id": 1, "user": {"name": "Alice"}}',
    '{"id": 2, "user": {"name": "Bob", "age": 25}}',
    '{"id": 3, "user": {"name": "Charlie", "location": {"city": "SF"}}}'
]

# Flatten all objects
flattened_batch = cjson_tools.flatten_json_batch(objects)
for flat in flattened_batch:
    print(json.loads(flat))

# Generate unified schema from all objects
unified_schema = cjson_tools.generate_schema_batch(objects)
print(json.loads(unified_schema))

Performance Optimization

# For large datasets, enable multi-threading
large_dataset = [json.dumps({"data": i, "nested": {"value": i*2}}) for i in range(10000)]

# Auto-detect optimal thread count
result = cjson_tools.flatten_json_batch(large_dataset, use_threads=True)

# Specify thread count
result = cjson_tools.flatten_json_batch(large_dataset, use_threads=True, num_threads=4)

# Single-threaded for comparison
result = cjson_tools.flatten_json_batch(large_dataset, use_threads=False)

C Command Line Interface

# JSON Tools - High-performance JSON processing utility
# Usage: json_tools [options] [input_file]

# Options:
#   -h, --help                 Show help message
#   -f, --flatten              Flatten nested JSON (default)
#   -s, --schema               Generate JSON schema
#   -e, --remove-empty         Remove keys with empty string values
#   -n, --remove-nulls         Remove keys with null values
#   -r, --replace-keys <pattern> <replacement>
#                              Replace keys matching regex pattern
#   -v, --replace-values <pattern> <replacement>
#                              Replace string values matching regex pattern
#   -t, --threads [num]        Use multi-threading (auto-detect optimal count)
#   -p, --pretty               Pretty-print output
#   -o, --output <file>        Write to file instead of stdout

C CLI Examples

JSON Flattening

# From file
./bin/json_tools -f input.json

# From stdin with pretty printing
cat input.json | ./bin/json_tools -f -p

# Multi-threaded processing
./bin/json_tools -f -t 4 large_batch.json

# Save to file
./bin/json_tools -f -o flattened.json input.json

Schema Generation

# Generate schema from file
./bin/json_tools -s input.json

# Multi-threaded schema generation
./bin/json_tools -s -t 4 large_batch.json

# Pretty-printed schema to file
./bin/json_tools -s -p -o schema.json input.json

Example Input/Output

JSON Flattening

Input:

{
  "name": "John Doe",
  "age": 30,
  "address": {
    "street": "123 Main St",
    "city": "Anytown"
  },
  "skills": ["programming", "design"]
}

Output:

{
  "name": "John Doe",
  "age": 30,
  "address.street": "123 Main St",
  "address.city": "Anytown",
  "skills[0]": "programming",
  "skills[1]": "design"
}

JSON Schema Generation

Input:

[
  {
    "id": 1,
    "name": "John",
    "email": "john@example.com",
    "active": true
  },
  {
    "id": 2,
    "name": "Jane",
    "email": "jane@example.com",
    "active": false,
    "tags": ["admin", "user"]
  }
]

Output:

{
  "$schema": "http://json-schema.org/draft-07/schema#",
  "type": "object",
  "properties": {
    "id": {
      "type": "integer"
    },
    "name": {
      "type": "string"
    },
    "email": {
      "type": "string"
    },
    "active": {
      "type": "boolean"
    },
    "tags": {
      "type": ["array", "null"],
      "items": {
        "type": "string"
      }
    }
  },
  "required": ["id", "name", "email", "active"]
}

JSON Filtering

Remove Empty Strings:

# Remove keys with empty string values
echo '{"name": "John", "email": "", "phone": "123-456-7890", "bio": ""}' | ./bin/json_tools -e -

# Output: {"name":"John","phone":"123-456-7890"}

Remove Null Values:

# Remove keys with null values
echo '{"name": "John", "email": null, "phone": "123-456-7890", "address": null}' | ./bin/json_tools -n -

# Output: {"name":"John","phone":"123-456-7890"}

Complex Example:

# Input with nested objects and arrays
echo '{
  "user": {
    "name": "John Doe",
    "email": "",
    "profile": {
      "bio": "",
      "website": null,
      "social": {
        "twitter": "",
        "linkedin": "john-doe",
        "github": null
      }
    }
  },
  "preferences": ["", "email", null, "sms"]
}' | ./bin/json_tools -e -p -

# Removes all empty strings recursively while preserving structure

Regex Key Replacement

Replace Keys with Patterns:

# Replace session timing keys
echo '{"session.pageTimesInMs.HomePage": 1500, "session.pageTimesInMs.AboutPage": 2000, "user.name": "John"}' | \
./bin/json_tools -r '^session\.pageTimesInMs\..*$' 'session.pageTimesInMs.PrezzePage' -

# Output: {"session.pageTimesInMs.PrezzePage":1500,"session.pageTimesInMs.PrezzePage":2000,"user.name":"John"}

Regex Value Replacement

Replace String Values with Patterns:

# Replace old status values
echo '{"user": {"status": "old_active", "role": "old_admin", "name": "John"}}' | \
./bin/json_tools -v '^old_.*$' 'new_value' -

# Output: {"user":{"status":"new_value","role":"new_value","name":"John"}}

Complex Example with Both:

# Input with both keys and values to replace
echo '{
  "session.timing.old_load": "old_slow",
  "session.timing.old_render": "old_fast",
  "user.name": "John"
}' | ./bin/json_tools -r '^session\.timing\..*$' 'session.timing.unified' -v '^old_.*$' 'new_value' -p -

# First replaces keys, then values, with pretty printing

Performance

The multi-threaded implementation is designed for processing large batches of JSON objects, though our benchmarks show interesting results:

  • For small files: Single-threaded processing is generally more efficient
  • For medium files: Multi-threading shows minimal improvements for specific operations
  • For large files: Current implementation shows thread overhead may outweigh benefits

Benchmarks

The project includes comprehensive benchmarking tools to measure performance:

# Run mini benchmarks (quick demonstration)
cd c-lib/tests
./run_mini_benchmarks.sh

# Run full benchmarks (may take several minutes)
./run_benchmarks.sh

# Generate visualization charts
cd ../../py-lib/benchmarks
python visualize_benchmarks.py

# Generate comprehensive visualization
python visualize_comprehensive_benchmarks.py

Benchmark results are saved to c-lib/tests/benchmark_results.md and c-lib/tests/comprehensive_benchmark_results.md, with visualizations in the corresponding PNG files.

Actual Benchmark Results

Benchmark Charts

Our comprehensive benchmarks revealed:

  • Small files (< 100KB): Multi-threading overhead outweighs benefits, with performance similar to or worse than single-threaded processing
  • Medium files (100KB-1MB): Multi-threading provides minimal improvement (0-12.5%) for schema generation
  • Large files (1MB-10MB): Current multi-threaded implementation shows slight performance degradation (-7% to -8%)

Key findings:

  1. Thread Overhead: For most file sizes, the overhead of creating and managing threads outweighs the benefits of parallel processing.

  2. Optimal Use Case: Multi-threading appears to be most beneficial for medium-sized files (around 1,000 objects) for schema generation.

  3. Future Optimizations: The multi-threaded implementation could be improved with:

    • More efficient work distribution
    • Thread pooling to reduce creation overhead
    • Optimized memory usage to reduce cache misses
    • Adaptive threading that only uses multiple threads when beneficial

For detailed benchmark analysis, see c-lib/tests/comprehensive_benchmark_results.md.

Python Usage

The Python bindings provide a simple, Pythonic interface to the cJSON-Tools library.

Installation

pip install cjson-tools

Examples

Flattening JSON

import json
from cjson_tools import flatten_json

# Flatten a single JSON object
nested_json = '''
{
    "person": {
        "name": "John Doe",
        "age": 30,
        "address": {
            "street": "123 Main St",
            "city": "Anytown",
            "zip": "12345"
        }
    }
}
'''

flattened = flatten_json(nested_json)
print(json.loads(flattened))
# Output: {"person.name": "John Doe", "person.age": 30, "person.address.street": "123 Main St", ...}

Batch Processing

from cjson_tools import flatten_json_batch

# Process multiple JSON objects at once
json_objects = [
    '{"a": {"b": 1}}',
    '{"x": {"y": {"z": 2}}}'
]

flattened_batch = flatten_json_batch(json_objects)
print(flattened_batch)
# Output: ['{"a.b": 1}', '{"x.y.z": 2}']

Schema Generation

from cjson_tools import generate_schema

# Generate a schema from a JSON object
json_obj = '''
{
    "id": 1,
    "name": "Product",
    "price": 29.99,
    "tags": ["electronics", "gadget"]
}
'''

schema = generate_schema(json_obj)
print(json.loads(schema))
# Output: {"type": "object", "properties": {"id": {"type": "number"}, ...}}

Multi-threading

from cjson_tools import flatten_json_batch, generate_schema_batch

# Enable multi-threading with a specific number of threads
flattened = flatten_json_batch(large_json_list, use_threads=True, num_threads=4)

# Auto-detect the optimal number of threads
schema = generate_schema_batch(large_json_list, use_threads=True)

For more examples, see the py-lib/examples directory.

🧪 Testing

Python Tests

cd py-lib

# Run unit tests
python3 tests/test_cjson_tools.py

# Run example script
python3 examples/example.py

# Performance testing
python3 -c "
import cjson_tools
import json
import time

# Quick performance test
data = [json.dumps({'id': i, 'nested': {'value': i*2}}) for i in range(1000)]
start = time.time()
result = cjson_tools.flatten_json_batch(data, use_threads=True)
print(f'Processed {len(data)} objects in {time.time()-start:.3f}s')
"

C Library Tests

cd c-lib/tests

# Run comprehensive dynamic tests
./run_dynamic_tests.sh

# Run specific test sizes
./run_dynamic_tests.sh --sizes "100,1000,10000"

# Build and run manual tests
make
./generate_test_data test.json 1000 3
../../bin/json_tools -f test.json

Benchmarking

# Python benchmarks
cd py-lib/benchmarks
python3 benchmark.py --quick

# C library benchmarks
cd c-lib/tests
./run_benchmarks.sh

# Memory profiling (requires valgrind)
valgrind --tool=memcheck --leak-check=full ../../bin/json_tools -f large_test.json

📦 Publishing & Distribution

Python Package Publishing

Setup for PyPI

cd py-lib

# Install build tools
pip install build twine

# Update version in setup.py
# Edit setup.py: version='1.4.0'

# Build package
python3 -m build

# Test upload to TestPyPI
twine upload --repository testpypi dist/*

# Upload to PyPI
twine upload dist/*

Automated Publishing (GitHub Actions)

# .github/workflows/publish.yml
name: Publish to PyPI
on:
  release:
    types: [published]
jobs:
  publish:
    runs-on: ubuntu-latest
    steps:
    - uses: actions/checkout@v3
    - name: Set up Python
      uses: actions/setup-python@v4
      with:
        python-version: '3.8'
    - name: Build and publish
      env:
        TWINE_USERNAME: __token__
        TWINE_PASSWORD: ${{ secrets.PYPI_API_TOKEN }}
      run: |
        cd py-lib
        pip install build twine
        python -m build
        twine upload dist/*

C Library Distribution

Creating Release Packages

# Create source distribution
make clean
tar -czf cjson-tools-1.4.0.tar.gz \
  --exclude='.git*' \
  --exclude='*.o' \
  --exclude='bin/*' \
  --exclude='py-lib/build' \
  --exclude='py-lib/*.egg-info' \
  .

# Create binary distribution (Linux)
make clean && make
mkdir -p cjson-tools-1.4.0-linux-x64/{bin,lib,include}
cp bin/json_tools cjson-tools-1.4.0-linux-x64/bin/
cp c-lib/include/*.h cjson-tools-1.4.0-linux-x64/include/
tar -czf cjson-tools-1.4.0-linux-x64.tar.gz cjson-tools-1.4.0-linux-x64/

Package Managers

Homebrew (macOS)
# Formula for Homebrew
class CjsonTools < Formula
  desc "High-performance JSON processing toolkit"
  homepage "https://github.com/amaye15/cJSON-Tools"
  url "https://github.com/amaye15/cJSON-Tools/archive/v1.4.0.tar.gz"
  sha256 "..."

  def install
    system "make"
    bin.install "bin/json_tools"
  end

  test do
    system "#{bin}/json_tools", "--help"
  end
end
APT Repository (Ubuntu/Debian)
# Build .deb package
mkdir -p cjson-tools-1.4.0/DEBIAN
cat > cjson-tools-1.4.0/DEBIAN/control << EOF
Package: cjson-tools
Version: 1.4.0
Architecture: amd64
Maintainer: Your Name <email@example.com>
Description: High-performance JSON processing toolkit
EOF

mkdir -p cjson-tools-1.4.0/usr/bin
cp bin/json_tools cjson-tools-1.4.0/usr/bin/
dpkg-deb --build cjson-tools-1.4.0

� Automated CI/CD Pipeline

This project includes comprehensive GitHub Actions workflows for automated testing, security scanning, performance monitoring, and deployment:

🔄 Continuous Integration (ci.yml)

  • Multi-platform testing: Ubuntu, macOS, Windows
  • Python version matrix: 3.8, 3.9, 3.10, 3.11, 3.12
  • C library testing: Build verification, memory leak detection with Valgrind
  • Python package testing: Installation, functionality, performance validation
  • Code quality: Black formatting, isort, flake8 linting
  • Security scanning: Bandit, Safety dependency checks
  • Integration tests: C CLI with Python validation, consistency checks

🔒 Security & Vulnerability Scanning (security.yml)

  • Dependency scanning: Python package vulnerabilities with Safety
  • Static analysis: CodeQL security analysis for C and Python
  • Container security: Trivy vulnerability scanning
  • License compliance: Automated license checking
  • Memory safety: AddressSanitizer and Valgrind testing
  • Weekly automated scans: Scheduled security monitoring

📊 Performance Monitoring (performance.yml)

  • Automated benchmarks: Multi-platform performance testing
  • Regression detection: Performance validation on PRs
  • Scalability testing: Dataset sizes from 100 to 100K objects
  • Memory efficiency: Memory usage monitoring and optimization
  • Performance visualization: Automated chart generation
  • Benchmark history: Long-term performance tracking

📦 Automated Publishing (publish.yml)

  • Multi-platform wheels: Linux, macOS, Windows (x86_64, ARM64)
  • Source distribution: Complete source package building
  • PyPI publishing: Automated release to PyPI on tags
  • Test PyPI: Optional test publishing for validation
  • GitHub releases: Automated release asset creation
  • Trusted publishing: Secure PyPI publishing with OIDC

📚 Documentation (docs.yml)

  • API documentation: Automated C and Python API docs
  • Usage examples: Comprehensive example generation
  • Performance guides: Optimization documentation
  • GitHub Pages: Automated documentation deployment
  • Release validation: Version consistency checking

🎯 Workflow Features

Quality Assurance:

  • ✅ Comprehensive test coverage across platforms and Python versions
  • ✅ Memory leak detection with Valgrind
  • ✅ Security vulnerability scanning
  • ✅ Performance regression detection
  • ✅ Code quality enforcement

Automation:

  • 🔄 Automatic testing on every PR and push
  • 📦 Automated PyPI publishing on releases
  • 📊 Weekly performance and security monitoring
  • 📚 Automatic documentation updates
  • 🏷️ Badge updates for README

Security:

  • 🔒 CodeQL static analysis
  • 🛡️ Container security scanning
  • 📋 License compliance monitoring
  • 🔍 Dependency vulnerability tracking
  • 🧪 Memory safety validation

Performance:

  • ⚡ Multi-platform benchmarking
  • 📈 Performance visualization
  • 🎯 Regression detection
  • 💾 Memory efficiency monitoring
  • 📊 Throughput analysis

🚀 Getting Started with CI/CD

  1. Fork the repository and enable GitHub Actions
  2. Configure secrets for PyPI publishing (if needed)
  3. Create a release to trigger automated publishing
  4. Monitor workflows in the Actions tab

The CI/CD pipeline ensures high code quality, security, and performance while automating the entire release process from development to production deployment.

�🔧 Development & Contributing

Development Setup

# Full development environment
git clone https://github.com/amaye15/cJSON-Tools.git
cd cJSON-Tools

# Setup pre-commit hooks
pip install pre-commit
pre-commit install

# Build everything
make clean && make
cd py-lib && pip install -e . && cd ..

# Run all tests
cd c-lib/tests && ./run_dynamic_tests.sh && cd ../..
cd py-lib && python3 tests/test_cjson_tools.py && cd ..

Code Quality

# C code formatting (if clang-format available)
find c-lib -name "*.c" -o -name "*.h" | xargs clang-format -i

# Python code formatting
cd py-lib
pip install black isort flake8
black .
isort .
flake8 .

Performance Profiling

# Profile C library
cd c-lib/tests
perf record ../../bin/json_tools -f large_test.json
perf report

# Profile Python extension
cd py-lib
python3 -m cProfile -o profile.stats examples/example.py
python3 -c "import pstats; pstats.Stats('profile.stats').sort_stats('cumulative').print_stats(20)"

📄 License

This project is open source and available under the MIT License.

🤝 Contributing

Contributions are welcome! Please feel free to submit a Pull Request. For major changes, please open an issue first to discuss what you would like to change.

Areas for Contribution

  • Performance optimizations
  • Additional output formats
  • Language bindings (Rust, Go, etc.)
  • Documentation improvements
  • Bug fixes and testing

📞 Support

  • Issues: GitHub Issues
  • Documentation: See py-lib/examples/ and c-lib/tests/
  • Performance: Run benchmarks with ./run_dynamic_tests.sh

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

cjson-tools-1.9.0.tar.gz (29.6 kB view details)

Uploaded Source

Built Distributions

If you're not sure about the file name format, learn more about wheel file names.

cjson_tools-1.9.0-cp312-cp312-win_amd64.whl (40.6 kB view details)

Uploaded CPython 3.12Windows x86-64

cjson_tools-1.9.0-cp312-cp312-musllinux_1_2_x86_64.whl (152.2 kB view details)

Uploaded CPython 3.12musllinux: musl 1.2+ x86-64

cjson_tools-1.9.0-cp312-cp312-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (156.3 kB view details)

Uploaded CPython 3.12manylinux: glibc 2.17+ x86-64

cjson_tools-1.9.0-cp312-cp312-macosx_11_0_arm64.whl (45.9 kB view details)

Uploaded CPython 3.12macOS 11.0+ ARM64

cjson_tools-1.9.0-cp312-cp312-macosx_10_13_x86_64.whl (47.7 kB view details)

Uploaded CPython 3.12macOS 10.13+ x86-64

cjson_tools-1.9.0-cp311-cp311-win_amd64.whl (40.5 kB view details)

Uploaded CPython 3.11Windows x86-64

cjson_tools-1.9.0-cp311-cp311-musllinux_1_2_x86_64.whl (152.2 kB view details)

Uploaded CPython 3.11musllinux: musl 1.2+ x86-64

cjson_tools-1.9.0-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (156.3 kB view details)

Uploaded CPython 3.11manylinux: glibc 2.17+ x86-64

cjson_tools-1.9.0-cp311-cp311-macosx_11_0_arm64.whl (45.9 kB view details)

Uploaded CPython 3.11macOS 11.0+ ARM64

cjson_tools-1.9.0-cp311-cp311-macosx_10_9_x86_64.whl (47.7 kB view details)

Uploaded CPython 3.11macOS 10.9+ x86-64

cjson_tools-1.9.0-cp310-cp310-win_amd64.whl (40.5 kB view details)

Uploaded CPython 3.10Windows x86-64

cjson_tools-1.9.0-cp310-cp310-musllinux_1_2_x86_64.whl (151.2 kB view details)

Uploaded CPython 3.10musllinux: musl 1.2+ x86-64

cjson_tools-1.9.0-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (155.3 kB view details)

Uploaded CPython 3.10manylinux: glibc 2.17+ x86-64

cjson_tools-1.9.0-cp310-cp310-macosx_11_0_arm64.whl (45.9 kB view details)

Uploaded CPython 3.10macOS 11.0+ ARM64

cjson_tools-1.9.0-cp310-cp310-macosx_10_9_x86_64.whl (47.7 kB view details)

Uploaded CPython 3.10macOS 10.9+ x86-64

cjson_tools-1.9.0-cp39-cp39-win_amd64.whl (40.5 kB view details)

Uploaded CPython 3.9Windows x86-64

cjson_tools-1.9.0-cp39-cp39-musllinux_1_2_x86_64.whl (151.1 kB view details)

Uploaded CPython 3.9musllinux: musl 1.2+ x86-64

cjson_tools-1.9.0-cp39-cp39-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (155.1 kB view details)

Uploaded CPython 3.9manylinux: glibc 2.17+ x86-64

cjson_tools-1.9.0-cp39-cp39-macosx_11_0_arm64.whl (45.9 kB view details)

Uploaded CPython 3.9macOS 11.0+ ARM64

cjson_tools-1.9.0-cp39-cp39-macosx_10_9_x86_64.whl (47.7 kB view details)

Uploaded CPython 3.9macOS 10.9+ x86-64

cjson_tools-1.9.0-cp38-cp38-win_amd64.whl (40.5 kB view details)

Uploaded CPython 3.8Windows x86-64

cjson_tools-1.9.0-cp38-cp38-musllinux_1_2_x86_64.whl (150.8 kB view details)

Uploaded CPython 3.8musllinux: musl 1.2+ x86-64

cjson_tools-1.9.0-cp38-cp38-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (155.3 kB view details)

Uploaded CPython 3.8manylinux: glibc 2.17+ x86-64

cjson_tools-1.9.0-cp38-cp38-macosx_11_0_arm64.whl (45.7 kB view details)

Uploaded CPython 3.8macOS 11.0+ ARM64

cjson_tools-1.9.0-cp38-cp38-macosx_10_9_x86_64.whl (47.4 kB view details)

Uploaded CPython 3.8macOS 10.9+ x86-64

File details

Details for the file cjson-tools-1.9.0.tar.gz.

File metadata

  • Download URL: cjson-tools-1.9.0.tar.gz
  • Upload date:
  • Size: 29.6 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.12.9

File hashes

Hashes for cjson-tools-1.9.0.tar.gz
Algorithm Hash digest
SHA256 4738922e5994b932bd3ed1c5fa51661a41e7b440278fcd4bb709042798ae29fd
MD5 8bcd46823550a843c7e924caee338097
BLAKE2b-256 7bff2616aade7a7434e033129e6bf1803a3fc5aba70f1e5ee94163a96c3947b0

See more details on using hashes here.

File details

Details for the file cjson_tools-1.9.0-cp312-cp312-win_amd64.whl.

File metadata

File hashes

Hashes for cjson_tools-1.9.0-cp312-cp312-win_amd64.whl
Algorithm Hash digest
SHA256 5ddf224f9cc6169289cada26ce269b932f0a514ce7f75566784d90e9f29ef2b8
MD5 9b1288b0f76b5e7e8c6028131ffbc04f
BLAKE2b-256 3d89c0f546ff584e6fe16c0a51dd9cf211b436b1d4d6fe992ff4f0fe1c88a4ef

See more details on using hashes here.

File details

Details for the file cjson_tools-1.9.0-cp312-cp312-musllinux_1_2_x86_64.whl.

File metadata

File hashes

Hashes for cjson_tools-1.9.0-cp312-cp312-musllinux_1_2_x86_64.whl
Algorithm Hash digest
SHA256 d6e5602c89d5afa0065c4d265b1a096a2c3070e80a63d69e3c414383ee31f2e3
MD5 999cccf36c2b6707aaa0150debb69f53
BLAKE2b-256 88c0d4eaf48bb25559ba2a9861473e23ff04a08906dfa32046e4cd76d69fa069

See more details on using hashes here.

File details

Details for the file cjson_tools-1.9.0-cp312-cp312-manylinux_2_17_x86_64.manylinux2014_x86_64.whl.

File metadata

File hashes

Hashes for cjson_tools-1.9.0-cp312-cp312-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 649ba0aae0bf87c71a9572d1bd20a31e580065227c2375aab0a7daf16b014695
MD5 6c7db1128c4776abf32ef8c86cc4a80b
BLAKE2b-256 18dbb6d253fea46709d174ed8b071892447a1e6079e0b41a5800d6a1e125c532

See more details on using hashes here.

File details

Details for the file cjson_tools-1.9.0-cp312-cp312-macosx_11_0_arm64.whl.

File metadata

File hashes

Hashes for cjson_tools-1.9.0-cp312-cp312-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 0477556baa3709df4d5aa1e7b320bac9ca680b3db9580c6c8dc826e55e6d3c15
MD5 9388f98ca944b0983af6b57d3d53e9e0
BLAKE2b-256 7c8cd623b1364a79cd74805cc71fc096049dc246b5cfcb145517c3ff3da6e7e2

See more details on using hashes here.

File details

Details for the file cjson_tools-1.9.0-cp312-cp312-macosx_10_13_x86_64.whl.

File metadata

File hashes

Hashes for cjson_tools-1.9.0-cp312-cp312-macosx_10_13_x86_64.whl
Algorithm Hash digest
SHA256 d06307dd3db7dcbd7d738a22e19ac281964c13a442a372af85125f0da4e1e043
MD5 e1f16a797285012c76ead29324c7bd6c
BLAKE2b-256 543b4909a19df212d6ffc35d212e57e2b57af5ab5fee49773598f9c22aa10a7d

See more details on using hashes here.

File details

Details for the file cjson_tools-1.9.0-cp311-cp311-win_amd64.whl.

File metadata

File hashes

Hashes for cjson_tools-1.9.0-cp311-cp311-win_amd64.whl
Algorithm Hash digest
SHA256 e77be6fde29e0df4401f1fc8b5f7aed418ee980c12007dd4e73df8b39fa246bf
MD5 d4ac18bac3bc0abac3a1cebd5c2bac1a
BLAKE2b-256 813943eb42f98cd32fcc098c341282235b7982aaa23a792c6a0792bced19a429

See more details on using hashes here.

File details

Details for the file cjson_tools-1.9.0-cp311-cp311-musllinux_1_2_x86_64.whl.

File metadata

File hashes

Hashes for cjson_tools-1.9.0-cp311-cp311-musllinux_1_2_x86_64.whl
Algorithm Hash digest
SHA256 614c802544bf77f74165c927cbafcf931e210c131bf2f3462f75c093a6b06b4e
MD5 965636cedca73827b9357d80cb8057d0
BLAKE2b-256 8fdeb5042071370200b9c0e07d8b24c3aa265183f46aac2b77b20db7c463efd3

See more details on using hashes here.

File details

Details for the file cjson_tools-1.9.0-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.whl.

File metadata

File hashes

Hashes for cjson_tools-1.9.0-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 0de9a33126917881405ff2031924188ec1fff9c253889c4fb2a782b82aacd2c0
MD5 893ad090f862c50e9b4e7294cc71a763
BLAKE2b-256 06947e628e34246c4d6cd7fded7e5252e71e33f9410a4d542deaab8533bd78ed

See more details on using hashes here.

File details

Details for the file cjson_tools-1.9.0-cp311-cp311-macosx_11_0_arm64.whl.

File metadata

File hashes

Hashes for cjson_tools-1.9.0-cp311-cp311-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 4647c2990b1a231ea91a2513fec1f10d5f6fc212fa2959b2e411675ccc51a345
MD5 4cd7fbeef98377baf77ee081c9d9e64d
BLAKE2b-256 750495076ae538fd5c2b39aef8701f41e530eb5e06c5796c8479b09110ce2f58

See more details on using hashes here.

File details

Details for the file cjson_tools-1.9.0-cp311-cp311-macosx_10_9_x86_64.whl.

File metadata

File hashes

Hashes for cjson_tools-1.9.0-cp311-cp311-macosx_10_9_x86_64.whl
Algorithm Hash digest
SHA256 76078b747dd778a454cf1ecbbb03c600a084eca2842bf615583d43c39eef7460
MD5 b3dec6c8f81fda9a49f283212cdc84c0
BLAKE2b-256 0b69a6002d7f34a1d733e4f3287d6e34197a1fc4d4a92a368c41809db867918f

See more details on using hashes here.

File details

Details for the file cjson_tools-1.9.0-cp310-cp310-win_amd64.whl.

File metadata

File hashes

Hashes for cjson_tools-1.9.0-cp310-cp310-win_amd64.whl
Algorithm Hash digest
SHA256 b59ba43cf73a2dee0b2eec0e0efc92160e05e2138e3fcc752854c1003eff0582
MD5 05470602267329b8d442825b9d19bdd0
BLAKE2b-256 2e729cea31f279f58c608a62723ad67f42cdebdc818f34f224ae978bd6b6bb33

See more details on using hashes here.

File details

Details for the file cjson_tools-1.9.0-cp310-cp310-musllinux_1_2_x86_64.whl.

File metadata

File hashes

Hashes for cjson_tools-1.9.0-cp310-cp310-musllinux_1_2_x86_64.whl
Algorithm Hash digest
SHA256 54c8a079e90e3e4b5ed659894bc7fdf78e6df09284d7ffe495aa3ec42b4a7d7e
MD5 5cbc62d4834e9c557edb1f2d4350040a
BLAKE2b-256 3a2b65948e950f1d4dcb9e9f5d5f3de8a557a4ada126b04aeb1c70cb132c0746

See more details on using hashes here.

File details

Details for the file cjson_tools-1.9.0-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl.

File metadata

File hashes

Hashes for cjson_tools-1.9.0-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 b0b6ac28aa847801855782df30fb83e2dcf0511a5012a82f9d4e2cae3db5a7f9
MD5 f5efc54e84fbb4eba71200cd4527dab9
BLAKE2b-256 28271e8e20d47e38bf194a06436b1011d168a5ef90b446c523c4d9808868db5e

See more details on using hashes here.

File details

Details for the file cjson_tools-1.9.0-cp310-cp310-macosx_11_0_arm64.whl.

File metadata

File hashes

Hashes for cjson_tools-1.9.0-cp310-cp310-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 73e2ab9a98f7c7b22a28e6b82df22824cdd78369da5e149cc6aa3ef04ef19973
MD5 ddbb03ec0601502ab3e8cf36f9f39f25
BLAKE2b-256 a6b767eab5707f037d491871023ee7867870d406cec5226d4f7368f083625b89

See more details on using hashes here.

File details

Details for the file cjson_tools-1.9.0-cp310-cp310-macosx_10_9_x86_64.whl.

File metadata

File hashes

Hashes for cjson_tools-1.9.0-cp310-cp310-macosx_10_9_x86_64.whl
Algorithm Hash digest
SHA256 abcdd55ab0952075fd56a6d19a1715bf99af1db26b79ca080c5eb55e91aaca3b
MD5 8dbe4b3611069719d49fdd8c558691ef
BLAKE2b-256 3835e0c76f6281c70d606f3f0d79d34d9cc8f45a02c7ad0d677a8c456b3ce0c0

See more details on using hashes here.

File details

Details for the file cjson_tools-1.9.0-cp39-cp39-win_amd64.whl.

File metadata

  • Download URL: cjson_tools-1.9.0-cp39-cp39-win_amd64.whl
  • Upload date:
  • Size: 40.5 kB
  • Tags: CPython 3.9, Windows x86-64
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.12.9

File hashes

Hashes for cjson_tools-1.9.0-cp39-cp39-win_amd64.whl
Algorithm Hash digest
SHA256 3e98d5edd1e71930808d090d1accd25d8ba1b8d1958cb8b2dd027a20e7790ff4
MD5 1206a8b03e900f3fd24cbb29bfa10d14
BLAKE2b-256 94b2cae0797f0fda70510977d6aeefd25c3a8556974558fcdff0992216db5c18

See more details on using hashes here.

File details

Details for the file cjson_tools-1.9.0-cp39-cp39-musllinux_1_2_x86_64.whl.

File metadata

File hashes

Hashes for cjson_tools-1.9.0-cp39-cp39-musllinux_1_2_x86_64.whl
Algorithm Hash digest
SHA256 027b563489e079a5ba85ea855516852a4cdbde6f13bb74b6422c5162285a7f4a
MD5 04575831970b64ddb2b9131ebacd6dd5
BLAKE2b-256 5421fc22e399d65e9a40e2ac5266cacf860ad41cc64d826e0ae91f71fead99ae

See more details on using hashes here.

File details

Details for the file cjson_tools-1.9.0-cp39-cp39-manylinux_2_17_x86_64.manylinux2014_x86_64.whl.

File metadata

File hashes

Hashes for cjson_tools-1.9.0-cp39-cp39-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 d5054efe3b6d91052a2a5ae878d09c7df38abc5a7a86d15b8d57450c6358bd30
MD5 80413c3762d8961f9611e8a5224cef0d
BLAKE2b-256 bc965e34486df9118fe440ce90bdd0ad3f1d96ef68c1f27706296f86a64120e8

See more details on using hashes here.

File details

Details for the file cjson_tools-1.9.0-cp39-cp39-macosx_11_0_arm64.whl.

File metadata

File hashes

Hashes for cjson_tools-1.9.0-cp39-cp39-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 d45681a46f631fa49afa90e5d3db0fcadc6aa07a8061ca9319c26744346dcc3b
MD5 689f290ca4312c6393d59d8f85734ade
BLAKE2b-256 ec2db08bc60072be7f3e1fda8b89a2f08a25937a9c00d2d7ca6e78e1e3b1aeb5

See more details on using hashes here.

File details

Details for the file cjson_tools-1.9.0-cp39-cp39-macosx_10_9_x86_64.whl.

File metadata

File hashes

Hashes for cjson_tools-1.9.0-cp39-cp39-macosx_10_9_x86_64.whl
Algorithm Hash digest
SHA256 28ca9eb08250c01c3ecee5ad30dc57584059cd74278486bdb42ca839a6600383
MD5 9d000c189cde3c11385b7a1601a4e81e
BLAKE2b-256 acdc7be339b5b69d8957adf39e4834b50871f9934fb010e6893f5f79b6b6d535

See more details on using hashes here.

File details

Details for the file cjson_tools-1.9.0-cp38-cp38-win_amd64.whl.

File metadata

  • Download URL: cjson_tools-1.9.0-cp38-cp38-win_amd64.whl
  • Upload date:
  • Size: 40.5 kB
  • Tags: CPython 3.8, Windows x86-64
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.12.9

File hashes

Hashes for cjson_tools-1.9.0-cp38-cp38-win_amd64.whl
Algorithm Hash digest
SHA256 4a5255d3872619b06957f40365fbe62764aae4982dc0ccfe1434c4306679294c
MD5 c0588ad3fbcb5520a0482163ce190272
BLAKE2b-256 d545d1400d83fddcf1808676b5b84775e9ed8fb8963ae792b75057a94aad0210

See more details on using hashes here.

File details

Details for the file cjson_tools-1.9.0-cp38-cp38-musllinux_1_2_x86_64.whl.

File metadata

File hashes

Hashes for cjson_tools-1.9.0-cp38-cp38-musllinux_1_2_x86_64.whl
Algorithm Hash digest
SHA256 1244ac1780bef29152f67acc045687df0bac3cc71a94e2bf4451ce0d600f5c98
MD5 0450eff018069338fcb58e6d334905ce
BLAKE2b-256 135668fd0e49234e844421ebcc3508a24a0f5db526c95c24ccaab21e81cdbc7e

See more details on using hashes here.

File details

Details for the file cjson_tools-1.9.0-cp38-cp38-manylinux_2_17_x86_64.manylinux2014_x86_64.whl.

File metadata

File hashes

Hashes for cjson_tools-1.9.0-cp38-cp38-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 09c924886dca8d0521a8820b76cb7736fff02c8943723166a00dd82ce6792210
MD5 148fe258e1ecef610cc95524299c981c
BLAKE2b-256 7ce276825bd5366a26b58b4ed6d31aaadb8620535c7d9662f793805c9c887c59

See more details on using hashes here.

File details

Details for the file cjson_tools-1.9.0-cp38-cp38-macosx_11_0_arm64.whl.

File metadata

File hashes

Hashes for cjson_tools-1.9.0-cp38-cp38-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 2112363c8057e735979a626350f196dd64336d3a1a4ffe6c0099494d885ea4e5
MD5 de251bed0bccde484faeddf49695cc52
BLAKE2b-256 d647263cfbd9aaf5d3904029f264fe43977a574ea337b081d804cd35a1380a80

See more details on using hashes here.

File details

Details for the file cjson_tools-1.9.0-cp38-cp38-macosx_10_9_x86_64.whl.

File metadata

File hashes

Hashes for cjson_tools-1.9.0-cp38-cp38-macosx_10_9_x86_64.whl
Algorithm Hash digest
SHA256 835a414bacad77cc324141d9c3f9df633b7c732e1ebb3c6f4324e30e4a619861
MD5 bfaf7e99e63261b15d600314b8675188
BLAKE2b-256 5ff78ca216f33c8686b6d035555bab1b5eb12f46fcc37df2b72f41d69520abf3

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