Table Of Contents

Previous topic

25.3. maketzjs

Next topic

25.11. dae2json

This Page

25.6. json2json

25.6.1. Usage

Syntax

json2json [options] source.json [ ... ] target.json

Merge JSON asset files.

25.6.2. Options

--version

Show program’s version number and exit.

--help, -h

Show help message and exit.

--verbose, -v

Verbose output.

--silent, -s

Silent running.

--metrics, -m

Generate asset metrics.

25.6.3. Example

json2json -v -m source1.json source2.json target.json

25.7. json2tar

25.7.1. Usage

Syntax

json2tar [options] -i input.json -o output.tar

Generate a TAR file for binary assets referenced from a JSON asset.

25.7.2. Options

--version

Show program’s version number and exit.

--help, -h

Show help message and exit.

--verbose, -v

Verbose output.

--silent, -s

Silent running.

--input=INPUT, -i INPUT

Input JSON file to process.

--output=OUTPUT, -o OUPUT

Output TAR file to generate.

--assets=PATH, -a PATH

Path of the asset root containing all assets referenced by the JSON file.

-M

Output dependencies.

--MF=DEPENDENCY_FILE

Dependencies output to file.

25.7.3. Example

json2tar -v -i samples/models/duck.dae.json -o samples/models/duck.tar -a assets

25.8. json2stats

25.8.1. Usage

Syntax

json2stats [options] asset.json [ ... ]

Report metrics on JSON asset files.

Metrics are:

  • keys: number of bytes used by keys.
  • punctuation (punctn): number of bytes used by JSON punctuation, including ‘[ ] { } ” , :’.
  • values: number of bytes used by values. For uncompact JSON files this will also include the white space.
  • k%: percentage of total size used by the keys.
  • p%: percentage of total size used by the punctuation.
  • v%: percentage of total size used by the values (and white space).
  • # keys: the total number of keys.
  • unique: the number of unique keys.
  • total: the total asset size in byte.
  • gzip: the asset size after gzip compression.
  • ratio: the gzip size as a percentage of the uncompressed total size.

25.8.2. Options

--version

Show program’s version number and exit.

--help, -h

Show help message and exit.

--verbose, -v

Verbose output.

--silent, -s

Silent running.

--metrics, -m

Output asset metrics

--header, -H

Generate column header

This tool current assumes the JSON asset is compact with no additional white space.

25.8.3. Example

json2stats -v -H samples/models/*.json

Outputs:

+-------------------------+----------------------+---------------+------------------------+
|    keys: punctn: values |     k%:    p%:    v% | # keys:unique |   total:   gzip: ratio |
+-------------------------+----------------------+---------------+------------------------+
|    6132:  94002: 441845 |   1.1%: 17.3%: 81.5% |    658:   177 |  541979: 123824: 22.8% | samples/models/Seymour.dae.json
|    6670:  94504: 442359 |   1.2%: 17.4%: 81.4% |    730:   183 |  543533: 123805: 22.8% | samples/models/Seymour_anim2.dae.json
|    5266: 113976: 611462 |   0.7%: 15.6%: 83.7% |    563:   177 |  730704: 160746: 22.0% | samples/models/Seymour_anim2_rot90_anim_only.dae.json
|     436:    737:    662 |  23.8%: 40.2%: 36.1% |     68:    43 |    1835:    604: 32.9% | samples/models/cube.dae.json
|    2374: 498398:3210566 |   0.1%: 13.4%: 86.5% |    316:    75 | 3711338: 761215: 20.5% | samples/models/diningroom.dae.json
|     538:  56067: 277087 |   0.2%: 16.8%: 83.0% |     70:    55 |  333692: 102407: 30.7% | samples/models/duck.dae.json
|     409:   7958:  33016 |   1.0%: 19.2%: 79.8% |     55:    42 |   41383:   8470: 20.5% | samples/models/sphere.dae.json
+-------------------------+----------------------+---------------+------------------------+
|   21825: 865642:5016997 |   0.4%: 14.7%: 85.0% |   2460:   752 | 5904464:1281071: 21.7% | cumulative total and global ratio
+-------------------------+----------------------+---------------+------------------------+

25.9. xml2json

25.9.1. Usage

Syntax

xml2json [options] -i input.xml -o output.json

Convert XML assets into a structured JSON asset.

25.9.2. Options

--version

Show program’s version number and exit.

--help, -h

Show help message and exit.

--verbose, -v

Verbose output.

--silent, -s

Silent running.

--metrics, -m

Output asset metrics

--input=INPUT, -i INPUT

Input XML file to process

--output=OUTPUT, -o OUTPUT

Output JSON file to process

25.9.3. Asset Generation Options

--json-indent=SIZE, -j SIZE

JSON output pretty printing indent size, defaults to 0

--namespace, -n

Maintain XML xmlns namespace in JSON asset keys.

--convert-types, -c

Attempt to convert values to ints, floats and lists.

25.9.4. Example

xml2json -v -j 2 -c -i asset.xml -o asset.json

25.10. json2txt

25.10.1. Usage

Syntax

json2txt [options] -i input.json [-o output.html]

Generate plain text or html from a JSON asset.

25.10.2. Options

--help, -h

Show help message and exit.

--version

Show program’s version number and exit.

--verbose, -v

Verbose output.

--silent, -s

Silent running.

--input=INPUT, -i INPUT

Input JSON file to process.

--output=OUTPUT, -o OUTPUT

Output file to generate (optional). If not specified, output is displayed on the terminal. If specified, flags –html or –txt can be used (by default will output as plain text).

--path=PATH, -p PATH

Path of the required node to output in the JSON asset tree structure. Support for wildcards enabled.

--listcull=NUMBER, -l NUMBER

Culling parameter to specify the maximum length of the lists to be displayed. NUMBER=0 displays all contents (defaults to 3).

--dictcull=NUMBER, -c NUMBER

Culling parameter to specify the maximum length of the dictionaries to be displayed. NUMBER=0 displays all contents (defaults to 3).

--depth=NUMBER, -d NUMBER

Parameter of the dictionary and list rendering depth (defaults to 2).

--html

Output data in HTML format.

--txt

Output in plain text format (default)

--color

Enable colored text output.

25.10.3. Example

json2txt -i samples/models/duck.dae.json -o duck.txt --txt
json2txt -i samples/models/duck.dae.json -p geometries
json2txt -i samples/models/duck.dae.json -p geom*/*
json2txt -i samples/models/duck.dae.json -p geom*/cu*/surf*/lam* -c 0