Skip to content

joechung2008/json-rb

Repository files navigation

json.rb

JSON parser ported from TypeScript to Ruby 3.3.9

License

MIT

Reference

json.org

Commands

Install dependencies

Install all required gems for the project:

bundle install

Run the CLI

Start the command-line interface for this library:

ruby bin/cli

Lint with RuboCop

Check your Ruby code for style and quality issues:

bundle exec rubocop

Format Ruby code with RuboCop

Automatically format your Ruby code to follow community standards:

bundle exec rubocop -x

Test with RSpec

Run the test suite to verify your code works as expected:

bundle exec rspec

Test Coverage: This project uses SimpleCov for test coverage reporting. Coverage reports are generated in the coverage/ directory and show current line coverage of 84.79%. Open coverage/index.html in a browser to view detailed coverage reports.

Build the Gem Locally

To build the json-rb gem locally for use in other projects without publishing:

mkdir -p pkg && gem build json_rb.gemspec --output pkg/json_rb-0.1.0.gem

This creates a json_rb-0.1.0.gem file in the pkg/ directory.

Run the Grape API

Start the Grape-based API server:

bundle exec rackup api_grape/config.ru -p 8000 -s webrick

Run the Rails API

See api_rails/README.md for instructions on how to run the Rails API.

Run the Roda API

Start the Roda-based API server:

bundle exec rackup api_roda/config.ru -p 8000 -s webrick

Run the Sinatra API

Start the Sinatra-based API server:

The API will be available at http://localhost:8000.

bundle exec rackup api_sinatra/config.ru -p 8000 -s webrick

Test API endpoints with REST Client (VS Code Extension)

You can use the REST Client extension in VS Code to send requests to the API servers.

  1. Create a .rest file (see testdata/ for examples).
  2. Add a request, for example:
POST http://localhost:8000/api/v1/parse
Content-Type: application/json

{
  "foo": "bar"
}
  1. Click "Send Request" above the request in VS Code to see the response.

About

No description or website provided.

Topics

Resources

License

Stars

Watchers

Forks

Contributors 2

  •  
  •