Super Yaml Parser is a simple way to turn a json into a yaml file and vice versa
Simple Jsons also work with .properties files
To setup simply type npm install super-yaml-parser --save
in a console
Then in your script add const yamlParser = require("super-yaml-parser")
yamlParser.toJson(yamlString)
- Takes a yaml string and returns a json
yamlParser.toJsonFromFile(fileName, fileOptions)
- Takes a yaml file and returns a json
encoding - A valid file encoding type "us_ascii", "utf8", "ebcdic", "utf16", "utf32"
Strings, Objects, Arrays, Strings in Objects, Arrays in Objects, Objects in Objects
yamlParser.toYaml(json, options)
- Takes a json and returns a yaml object
yamlParser.toYamlFromFile(fileName, fileOptions, options)
- Takes a json file and returns a yaml object
indentAmount - Number - How many spaces to use for an indent
propertiesCompatability - Boolean - Wether or not to enable compatability with .properties files
encoding - A valid file encoding type "us-ascii", "utf8", "utf-8", "ebcdic", "utf16", "utf-16", "utf32", "utf-32"
Strings, Objects, Arrays, Strings in Objects, Arrays in Objects, Objects in Objects, .propertie files
Json.toString()
- Turns a Json object into a string
Json.toNormal()
- Turns a Json object into a normal JSON
Json.toYaml()
- Turns a Json object into a Yaml object
Yaml.toString()
- Turns a Yaml object into a string
Yaml.toJson()
- Turns a Yaml object into a Json object
Static
YAML.parse(json)
- Takes a Json object and returns a Yaml
YAML.parseString(string)
- Takes a string and returns a Yaml
YAML.stringify(yaml)
- Takes a Yaml object and returns a string
YAML.jsonify(yaml)
- Takes a Yaml object and returns a Json