Converter between multiple open-standard file formats.
Project description
fconv
fconv is a Command-Line utility and library for converting between multiple file formats such as JSON, YAML.
Getting started
pip install fconv
$ fconv --v
version: x.x.x
Features
-
Convert a file into other formatted file
-
Supported format
- json
- yaml
- toml
- xml
-
To be supported
- ini
You can use fconv as command-line tool and Python module.In condition of using as a module, fconv supports optional arguments.
To know which options are available,
See the reference:
- json:https://docs.python.org/3/library/json.html
- yaml:https://pyyaml.org/wiki/PyYAMLDocumentation
- toml:https://github.com/uiri/toml
- xml:https://github.com/martinblech/xmltodict
Example
Use as a module
>>> from fconv.core import Former
>>> from fconv.formats.json import Json
>>> from fconv.formats.yaml import Yaml
>>> f = Former(src_format=Json, target_format=Yaml)
>>> f.form('{"key1":"value1"}')
'key1: value1\\n'
>>> f = Former(src_format=Yaml, target_format=Json, out_opt={'indent':3})
>>> f.form('key1: value1\\n')
'{\\n "key1": "value1"\\n}'
Use as a command-line tool
Basic usage
fconv <source format> <target format> -i <source file name>
Convert json file into yaml and print out
fconv json yaml -i sample.json
Convert yaml file into json formated file
fconv yaml json -i sample.yaml -o result.json
Contribution
Have a look through existing Issues and Pull Requests that you could help with. If you'd like to request a feature or report a bug, please create a GitHub Issue using one of the templates provided.
License
Licensed under the MIT License.
Project details
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.