Write models objects to JSON
JSON files for model objects are already used in useeio.js but they are retrieved from the USEEIO_API.
Alternative is to write JSON objects directly from useeior.
Currently the following relevant writing is occurring:
-
Matrices are written to binary in writeModelMatrices Recommend modifying to accept a "json" option for to_format
-
Model metadata is written to csv in writeModelMetadata
-
Model demands are already written to JSON in writeModelDemandstoJSON No changes recommended. The JSON writing here should be used as a template to modify other functions. for instance use jsonlite
-
The Sector Crosswalk is written to csv in writeSectorCrosswalk Add to_format parameter with code to handle "json" option
Then create a wrapper function analogous to writeModeltoExcel() but rather it will be writeModeltoJSON()
to validate the output the resulting JSON needs to be compared to the JSON for a model retrieved from the USEEIO_API via useeio.js or useeio-widgets