holochain / hdk-assemblyscript

The Holochain Developer Kit for Assemblyscript
41 stars 2 forks source link

WIP: Decoding function parameters from JSON string #7

Open willemolding opened 6 years ago

willemolding commented 6 years ago

Here is a proposed solution to parsing the parameters to a function passed as a JSON string.

This current implementation only supports primitives and string arguments but extending it to also accept objects and arrays should not be too difficult.

It uses asm-json-parser which is a module I write for event driven JSON parsing in assemblyscript. Using this to define a parser for a custom class is pretty straightforward and most of this boilerplate will be generated by the transform stage.

Inviting feedback and comments before going further

Closes #4