How to use the jju.stringify function in jju

To help you get started, we’ve selected a few jju 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 microsoft / rushstack / libraries / node-core-library / src / JsonFile.ts View on Github external
if (!options) {
      options = {};
    }

    JsonFile.validateNoUndefinedMembers(newJsonObject);

    let stringified: string;

    if (previousJson !== '') {
      // NOTE: We don't use mode=json here because comments aren't allowed by strict JSON
      stringified = jju.update(previousJson, newJsonObject, {
        mode: 'cjson',
        indent: 2
      });
    } else if (options.prettyFormatting) {
      stringified = jju.stringify(newJsonObject, {
        mode: 'json',
        indent: 2
      });
    } else {
      stringified = JSON.stringify(newJsonObject, undefined, 2);
    }

    // Add the trailing newline
    stringified = Text.ensureTrailingNewline(stringified);

    if (options && options.newlineConversion) {
      switch (options.newlineConversion) {
        case NewlineKind.CrLf:
          return Text.convertToCrLf(stringified);
        case NewlineKind.Lf:
          return Text.convertToLf(stringified);
github wiredmax / npm-json5 / lib / write.js View on Github external
function json2json(data) {
	var JSON5 = require("jju")
	return JSON5.stringify(JSON.parse(data.toString("utf8")))
}
github DefinitelyTyped / tsd / lib / formats.js View on Github external
function toJSON5(src) {
	var dest = path.join(path.dirname(src), path.basename(src, path.extname(src)) + '.json5');
	var obj = JSON.parse(fs.readFileSync(src, 'utf8'));
	fs.writeFileSync(dest, jju.stringify(obj, null, 4), 'utf8');
}
github werk85 / grunt-ng-constant / tasks / ngconstant.js View on Github external
'jju': function jjuSerializer(obj, serializerOptions) {
    return jju.stringify(obj, serializerOptions);
  },
  'json': function jsonSerializer(obj, serializerOptions) {

jju

a set of utilities to work with JSON / JSON5 documents

MIT
Latest version published 6 years ago

Package Health Score

67 / 100
Full package analysis