Skip to content

joechung2008/json-rs

Repository files navigation

json-rs

JSON Parser ported from TypeScript to Rust 1.89.0.

License

MIT

Reference

json.org

Prerequisites (Windows)

To ensure cargo install works for all dependencies, you must install mingw-w64 and the required toolchain:

  1. Download and install MSYS2.

  2. Open the MSYS2 terminal and run:

pacman -Syu
pacman -S mingw-w64-x86_64-toolchain
  1. Ensure the MSYS2 mingw64 environment is in your PATH, or use the MSYS2 MinGW 64-bit terminal for building Rust projects.

This will provide dlltool.exe and other tools needed for compiling certain crates.

Build

cargo build --workspace

Format

cargo fmt

Lint

cargo clippy -p api-actix -p api-axum -p api-rocket -p cli -p shared-lib --all-targets --all-features

Test

cargo test --workspace

Running the CLI

To build the CLI:

cargo build -p cli

To run the CLI with input from a file:

cargo run -p cli < input.json

Or, to run the CLI and enter JSON manually (press Ctrl+D to end input):

cargo run -p cli

Running the Actix Web API

cargo run -p api-actix

The server will start and listen for HTTP requests (default: http://localhost:8000).

Running the Axum API

cargo run -p api-axum

The server will start and listen for HTTP requests (default: http://localhost:8080).

Running the Rocket API & Testing with REST Client

Run the Rocket API

cargo run -p api-rocket

The server will start and listen for HTTP requests (default: http://localhost:8000).

Test the API with REST Client

  1. Install the REST Client extension in VSCode.
  2. Open any .rest file in the testdata/ directory (e.g., testdata/all.rest).
  3. Click "Send Request" above a request to send it to the running API server.
  4. View the response directly in VSCode.

You can modify or add .rest files in testdata/ to create custom requests for testing.

About

No description or website provided.

Topics

Resources

License

Stars

Watchers

Forks