# wast2json `wast2json` converts a `.wast` file to a `.json` file, and a collection of associated `.wat` file and `.wasm` files. ## Example ```sh # parse spec-test.wast, and write files to spec-test.json. Modules are written # to spec-test.0.wasm, spec-test.1.wasm, etc. $ bin/wast2json spec-test.wast -o spec-test.json ``` ## Wast The wast format is described in the [spec interpreter](https://github.com/WebAssembly/spec/tree/master/interpreter#scripts). It is an extension of the `.wat` text format, with additional commands for running scripts. The syntax is repeated here: ``` script: * cmd: ;; define, validate, and initialize module ( register ? ) ;; register module for imports module with given failure string ;; perform action and print results ;; assert result of an action ;; meta command module: ... ( module ? binary * ) ;; module in binary format (may be malformed) ( module ? quote * ) ;; module quoted in text (may be malformed) action: ( invoke ? * ) ;; invoke function export ( get ? ) ;; get global export assertion: ( assert_return * ) ;; assert action has expected results ( assert_trap ) ;; assert action traps with given failure string ( assert_exhaustion ) ;; assert action exhausts system resources ( assert_malformed ) ;; assert module cannot be decoded with given failure string ( assert_invalid ) ;; assert module is invalid with given failure string ( assert_unlinkable ) ;; assert module fails to link ( assert_trap ) ;; assert module traps on instantiation result: ( .const ) numpat: ;; literal result nan:canonical ;; NaN in canonical form nan:arithmetic ;; NaN with 1 in MSB of payload meta: ( script ?