create package json
Use streambuffer, call cabback with error on error