https://github.com/skyzyx/yml2json
A YAML → JSON converter for the command line. Written in Python.
https://github.com/skyzyx/yml2json
json python yaml
Last synced: 12 months ago
JSON representation
A YAML → JSON converter for the command line. Written in Python.
- Host: GitHub
- URL: https://github.com/skyzyx/yml2json
- Owner: skyzyx
- Created: 2016-04-03T22:13:17.000Z (about 10 years ago)
- Default Branch: master
- Last Pushed: 2024-05-20T21:08:45.000Z (about 2 years ago)
- Last Synced: 2025-06-28T12:55:42.526Z (12 months ago)
- Topics: json, python, yaml
- Language: Python
- Homepage: https://pypi.python.org/pypi/yml2json
- Size: 46.9 KB
- Stars: 4
- Watchers: 2
- Forks: 4
- Open Issues: 6
-
Metadata Files:
- Readme: README.md
- Changelog: CHANGELOG.md
Awesome Lists containing this project
README
# yml2json
[](https://github.com/skyzyx/yml2json)
[](https://github.com/skyzyx/yml2json/issues)
[](https://twitter.com/skyzyx)
Converts YAML input to JSON output. Relies on [PyYaml](http://pyyaml.org/wiki/PyYAML), and includes its features as well as its caveats.
## Features
* Small. Simple. Fast.
* Has been tested on Python 2.7.11 and Python 3.5.1.
* Supports [YAML 1.0](http://yaml.org/spec/1.0/) and [1.1](http://yaml.org/spec/1.1/), but not [1.2](http://www.yaml.org/spec/1.2/spec.html).
* Supports single-document YAML files, but not multi-document YAML files.
* Supports compressed and pretty JSON output.
* Supports input from a file or `stdin`.
* Seamlessly converts datestamps into ISO-8601 strings.
* Seamlessly converts YAML sets into JSON lists.
## Examples
```bash
yml2json sample.yml
yml2json sample.yml --pretty
yml2json sample.yml --output sample.json
yml2json sample.yml --output sample.json --pretty
cat sample.yml | yml2json
cat sample.yml | yml2json --pretty
cat sample.yml | yml2json --output sample.json
cat sample.yml | yml2json --output sample.json --pretty
```
## Installation
Using [Pip](https://pypi.python.org/pypi/yml2json):
```bash
pip install yml2json
```
## Developing
First, install [VirtualEnv](https://virtualenv.pypa.io).
```bash
pip install --upgrade virtualenv
```
Next, activate your virtual environment and install the dependencies.
```bash
virtualenv vendor && \
source vendor/bin/activate && \
pip install -r requirements.txt && \
pip install -r requirements2.txt
```
## Tests
```bash
make test
```
## Contributing
Here's the process for contributing:
1. Fork yml2json to your GitHub account.
2. Clone your GitHub copy of the repository into your local workspace.
3. Write code, fix bugs, and add tests with 100% code coverage.
4. Commit your changes to your local workspace and push them up to your GitHub copy.
5. You submit a GitHub pull request with a description of what the change is.
6. The contribution is reviewed. Maybe there will be some banter back-and-forth in the comments.
7. If all goes well, your pull request will be accepted and your changes are merged in.
## Authors, Copyright & Licensing
* Copyright (c) 2016 [Ryan Parman](http://ryanparman.com).
See also the list of [contributors](https://github.com/skyzyx/yml2json/contributors) who participated in this project.
Licensed for use under the terms of the [MIT] license.
[MIT]: http://www.opensource.org/licenses/mit-license.php