Converting WAST into JSON
The wast2json
tool reads the WAST format and parses it, checks for errors, and then converts WAST into the JSON file. It generates a JSON and WASM file associated with the WAST file. Then, it links the WASM inside the JSON:
$ /path/to/build/directory/of/wabt/wast2json add.wat -o add. json $ cat add.json {"source_filename": "add.wat", "commands": [ {"type": "module", "line": 1, "filename": "add.0.wasm"}]}
To check the various options supported by wast2json
, run the following command:
$ /path/to/build/directory/of/wabt/wast2json --help usage: wast2json [options] filename read a file in the wasm spec test format, check it for errors, and convert it to a JSON file and associated wasm binary files. examples: # parse spec-test.wast, and write files to spec-test.json. Modules are # written...