json-tools

Version, currently 1.0.02 versions

github.com/impatienttraveller/json-tools

An implementation of RFC-6901 and RFC-6902 in Crystal Lang

19 stars
0 dependents
License: MIT

Nothing has been indexed for 1.0.0 yet. The tag is recorded, its shard.yml has not been read, so the manifest and dependency list below are empty because they are unknown rather than because they are absent.

Installation

# Add this to your shard.yml
dependencies:
  json-tools:
    github: impatienttraveller/json-tools
    version: ~> 1.0.0

Then run:

shards install

shard.yml

No shard.yml has been indexed for 1.0.0. You can read it on the repository.

Dependencies

Unknown: the shard.yml for this version has not been read yet.

README

This README is the one indexed from the repository at its latest ref, not from the tag for this version.

# json-tools

[![Built with Crystal](https://img.shields.io/badge/built%20with-crystal-000000.svg?style=flat-square)](https://crystal-lang.org/)
[![Build Status](https://travis-ci.org/impatienttraveller/json-tools.svg?branch=master)](https://travis-ci.org/impatienttraveller/json-tools)
[![Releases](https://img.shields.io/github/release/impatienttraveller/json-tools.svg?style=flat-square)](https://github.com/impatienttraveller/json-tools/releases)

An implementation of [RFC-6901](https://tools.ietf.org/html/rfc6901) and [RFC-6902](https://datatracker.ietf.org/doc/rfc6902)

## Installation

Add this to your application's `shard.yml`:

```yaml
dependencies:
  json-tools:
    github: impatienttraveller/json-tools
```

## Usage

```crystal
require "json-tools"
```

Once you have a `JSON::Any` object in memory you can address any value using the `Pointer` class:

```crystal
json : JSON::Any = ...
val = Json::Tools::Pointer.new("/foo/0/bar").eval(json)
```

JSON object can be patched by using the `Patch` class:

```crystal
patch : JSON::Any = ...
json : JSON::Any = ...
patched_json = Json::Tools::Patch.new(patch).apply(json)
```

This creates a copy of the passed JSON object to work with and the original object is not altered.

## Development

Please raise a GitHub issue and document the commit with the following format:

```
[issue-x] Description
```

## Contributing

1. Fork it (<https://github.com/impatienttraveller/json-tools/fork>)
2. Create your feature branch (`git checkout -b my-new-feature`)
3. Commit your changes (`git commit -am 'Add some feature'`)
4. Push to the branch (`git push origin my-new-feature`)
5. Create a new Pull Request

## Contributors

- [ddcprg](https://github.com/ddcprg) Daniel del Castillo - creator, maintainer