json-beautify

WebJar for json-beautify

License

License

ISC
Categories

Categories

JSON Data
GroupId

GroupId

org.webjars.npm
ArtifactId

ArtifactId

json-beautify
Last Version

Last Version

1.0.1
Release Date

Release Date

Type

Type

jar
Description

Description

json-beautify
WebJar for json-beautify
Project URL

Project URL

http://webjars.org
Source Code Management

Source Code Management

https://github.com/gre/json-beautify

Download json-beautify

How to add to project

<!-- https://jarcasting.com/artifacts/org.webjars.npm/json-beautify/ -->
<dependency>
    <groupId>org.webjars.npm</groupId>
    <artifactId>json-beautify</artifactId>
    <version>1.0.1</version>
</dependency>
// https://jarcasting.com/artifacts/org.webjars.npm/json-beautify/
implementation 'org.webjars.npm:json-beautify:1.0.1'
// https://jarcasting.com/artifacts/org.webjars.npm/json-beautify/
implementation ("org.webjars.npm:json-beautify:1.0.1")
'org.webjars.npm:json-beautify:jar:1.0.1'
<dependency org="org.webjars.npm" name="json-beautify" rev="1.0.1">
  <artifact name="json-beautify" type="jar" />
</dependency>
@Grapes(
@Grab(group='org.webjars.npm', module='json-beautify', version='1.0.1')
)
libraryDependencies += "org.webjars.npm" % "json-beautify" % "1.0.1"
[org.webjars.npm/json-beautify "1.0.1"]

Dependencies

There are no dependencies for this project. It is a standalone project that does not depend on any other jars.

Project Modules

There are no modules declared in this project.

json-beautify

JSON.stringify with fixed maximum character width.

json-beautify is a fork of JSON.stringify json2.js implementation.

It has the exact same signature of JSON.stringify but it also adds an optional 4th parameter:

The maximum fixed character width (for instance 80).

Examples:

var beautify = require("json-beautify");

var obj = { str: "Hello World", num: 42, smallarray: [ 1, 2, 3, "foo", {} ], smallobject: { foo: "bar", bar: 42 }, bigarray: [ 1, 2, 3, "foo", { foo: "bar", bar: 42, arr: [ 1, 2, 3, "foo", {} ] } ], bigobject: { foo: [ 1, 2, 3, "foo", {} ], bar: 42, a: {b: { c: 42 }}, foobar: "FooBar" } };

With 100 fixed-spaces:

console.log(beautify(obj, null, 2, 100));
{
  "str": "Hello World",
  "num": 42,
  "smallarray": [ 1, 2, 3, "foo", {} ],
  "smallobject": { "foo": "bar", "bar": 42 },
  "bigarray": [ 1, 2, 3, "foo", { "foo": "bar", "bar": 42, "arr": [ 1, 2, 3, "foo", {} ] } ],
  "bigobject": { "foo": [ 1, 2, 3, "foo", {} ], "bar": 42, "a": { "b": { "c": 42 } }, "foobar": "FooBar" }
}

With 80 fixed-spaces:

console.log(beautify(obj, null, 2, 80));
{
  "str": "Hello World",
  "num": 42,
  "smallarray": [ 1, 2, 3, "foo", {} ],
  "smallobject": { "foo": "bar", "bar": 42 },
  "bigarray": [
    1,
    2,
    3,
    "foo",
    { "foo": "bar", "bar": 42, "arr": [ 1, 2, 3, "foo", {} ] }
  ],
  "bigobject": {
    "foo": [ 1, 2, 3, "foo", {} ],
    "bar": 42,
    "a": { "b": { "c": 42 } },
    "foobar": "FooBar"
  }
}

Versions

Version
1.0.1