add targetConfig to export
add parsing of targetConfig to import
make sure json objects are released on error conditions