https://github.com/fabasoad/yaml-json-xml-converter-action
GitHub action that converts YAML/JSON/XML file formats interchangeably
https://github.com/fabasoad/yaml-json-xml-converter-action
github-action github-actions json xml yaml
Last synced: 14 days ago
JSON representation
GitHub action that converts YAML/JSON/XML file formats interchangeably
- Host: GitHub
- URL: https://github.com/fabasoad/yaml-json-xml-converter-action
- Owner: fabasoad
- License: mit
- Archived: true
- Created: 2020-03-12T08:12:13.000Z (about 5 years ago)
- Default Branch: main
- Last Pushed: 2023-06-01T01:17:57.000Z (almost 2 years ago)
- Last Synced: 2025-03-01T19:40:16.932Z (about 1 month ago)
- Topics: github-action, github-actions, json, xml, yaml
- Language: JavaScript
- Homepage:
- Size: 3.54 MB
- Stars: 28
- Watchers: 2
- Forks: 4
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- Contributing: CONTRIBUTING.md
- Funding: .github/FUNDING.yml
- License: LICENSE
Awesome Lists containing this project
- awesome-actions - YAML/JSON/XML Converter - Converts YAML/JSON/XML file formats interchangeably. (Community Resources / Utility)
- fucking-awesome-actions - YAML/JSON/XML Converter - Converts YAML/JSON/XML file formats interchangeably. (Community Resources / Utility)
- awesome-workflows - YAML/JSON/XML Converter - Converts YAML/JSON/XML file formats interchangeably. (Community Resources / Utility)
README
# YAML/JSON/XML action (Deprecated)
> **This GitHub action is deprecated and no longer maintained starting from `2022/10/21`. Please use
> [Data Format Converter Action](https://github.com/marketplace/actions/data-format-converter-action)
> instead. It is faster, can be run on any OS and supports much more data formats than this one.**


[](https://lgtm.com/projects/g/fabasoad/yaml-json-xml-converter-action/alerts/)
[](https://lgtm.com/projects/g/fabasoad/yaml-json-xml-converter-action/context:javascript)
[](https://snyk.io/test/github/fabasoad/yaml-json-xml-converter-action)
[](https://codeclimate.com/github/fabasoad/yaml-json-xml-converter-action/maintainability)
[](https://codeclimate.com/github/fabasoad/yaml-json-xml-converter-action/test_coverage)Converts YAML/JSON/XML file formats interchangeably.
## Inputs
| Name | Required | Description | Possible values |
|------|----------|----------------------------------|-----------------------|
| path | Yes | Path to the file to be converted | _<Path>_ |
| from | Yes | Format of a file | `json`, `xml`, `yaml` |
| to | Yes | Format of a file as a result | `json`, `xml`, `yaml` |## Outputs
| Name | Required | Description |
|------|----------|---------------------------------------------|
| data | Yes | Result in a format defined in `to` argument |## Example usage
### Prerequisites
Let's imagine we need to transform _yaml_ file into _xml_ format and _json_ file into _yaml_ format.
- `docker-compose.yml` file that will be transformed into _json_ file.
```yaml
---
version: '3.7'
services:
mongo:
image: mongo:4.2.3-bionic
environment:
MONGO_INITDB_ROOT_USERNAME: root
MONGO_INITDB_ROOT_PASSWORD: abc123
networks:
- test-networknetworks:
test-network:
name: test-network
driver: bridge
```- `person.json` file that will be transformed into _yaml_ file.
```json
{
"name": "John Doe",
"age": 32,
"hobbies": ["Music", "PC Games"]
}
```### Workflow configuration
```yaml
name: Converton: push
jobs:
converter:
name: Run converter
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v1
- uses: fabasoad/yaml-json-xml-converter-action@main
id: yaml2xml
with:
path: 'docker-compose.yml'
from: 'yaml'
to: 'xml'
- name: Print yaml2xml result
run: echo "${{ steps.yaml2xml.outputs.data }}"
- uses: fabasoad/yaml-json-xml-converter-action@main
id: json2yaml
with:
path: 'package.json'
from: 'json'
to: 'yaml'
- name: Print json2yaml result
run: echo "${{ steps.json2yaml.outputs.data }}"
```### Result

> _Hint:_ If you define the same format for `from` and `to` parameters you can use this action to read the file :wink: