How to use json-to-pretty-yaml - 9 common examples

To help you get started, we’ve selected a few json-to-pretty-yaml examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github kyma-incubator / varkes / modules / openapi-mock / src / server / mock.ts View on Github external
}).then((result: any) => {
            if (result.errors) {
                throw new Error("Validation error of api '" + api.name + "':" + pretty_yaml.stringify(result.errors));
            }
            if (result.warnings) {
                LOGGER.warn("%s", pretty_yaml.stringify(result.warnings));
            }
        });
}
github uber / react-vis / www / generate / blogpost.js View on Github external
{
      type: 'input',
      name: 'categories',
      message: 'Categories (comma separated)',
    },
    {
      type: 'input',
      name: 'keywords',
      message: 'Keywords (comma separated)',
    },
  ])
  const slug = slugify(title)
  const destination = fromRoot('content/blog', slug)
  mkdirp.sync(destination)

  const yaml = jsToYaml.stringify(
    removeEmpty({
      slug,
      title,
      date: formatDate(new Date()),
      author: 'React Vis',
      description: `_${description}_`,
      categories: listify(categories),
      keywords: listify(keywords),
    }),
  )
  const markdown = prettier.format(`---\n${yaml}\n---\n`, {
    ...require('../prettier.config'),
    parser: 'mdx',
  })
  fs.writeFileSync(path.join(destination, 'index.md'), markdown)
github dotansimha / graphql-code-generator / packages / graphql-codegen-cli / src / init.ts View on Github external
function writeConfig(answers: Answers, config: Types.Config) {
  const ext = answers.config.toLocaleLowerCase().endsWith('.json') ? 'json' : 'yml';
  const content = ext === 'json' ? JSON.stringify(config) : YAML.stringify(config);
  const fullPath = resolve(process.cwd(), answers.config);
  const relativePath = relative(process.cwd(), answers.config);

  writeFileSync(fullPath, content, {
    encoding: 'utf-8'
  });

  return {
    relativePath,
    fullPath
  };
}
github aa2kb / serverless-modular / src / utils.js View on Github external
function jsontoYml(jsonData) {
  return jsonYml.stringify(jsonData);
}
github kyma-incubator / varkes / modules / openapi-mock / src / server / mock.ts View on Github external
}).then((result: any) => {
            if (result.errors) {
                throw new Error("Validation error of api '" + api.name + "':" + pretty_yaml.stringify(result.errors));
            }
            if (result.warnings) {
                LOGGER.warn("%s", pretty_yaml.stringify(result.warnings));
            }
        });
}
github kyma-incubator / varkes / modules / openapi-mock / src / server / mock.ts View on Github external
app.get(api.basepath + api.metadata + ".yaml", function (req, res) {
        res.type('text/x-yaml')
        res.status(200)
        res.send(pretty_yaml.stringify(spec))
    })
}
github dotansimha / graphql-code-generator / packages / graphql-codegen-cli / src / old-cli-config.ts View on Github external
config: rootConfig,
    generates: {
      [options.out]: transformTemplatesToPlugins(options, {
        ...rootConfig,
        ...(options.templateConfig || {})
      })
    },
    silent: options.silent,
    watch: options.watch,
    require: options.require
  };

  console['warn'](`
  Note: You are using the old API of graphql-code-generator. You can easily migrate by creating "codegen.yml" file in your project with the following content:
  
${YAML.stringify(configObject)}

  Then, make sure that your script is executing just "gql-gen" (without any cli flags).
  `);

  return configObject;
}
github kyma-incubator / varkes / modules / configuration / src / configuration.ts View on Github external
check_api.check_api(specInJson, {}, function (err: any, options: any) {
                        if (err) {
                            errors += "\nevent " + event.name + ": Schema validation Error \n" + pretty_yaml.stringify(err)
                        }
                    })
                }
github kyma-incubator / varkes / modules / openapi-mock / src / server / mock.ts View on Github external
app.get(api.basepath + api.metadata, function (req, res) {
        res.type('text/x-yaml')
        res.status(200)
        res.send(pretty_yaml.stringify(spec))
    });
    app.get(api.basepath + api.metadata + ".json", function (req, res) {

json-to-pretty-yaml

A node module to convert JSON to YAML

Apache-2.0
Latest version published 6 years ago

Package Health Score

65 / 100
Full package analysis

Popular json-to-pretty-yaml functions