JSON related fixes

Call complete, close objects, fixed parsing no-argument calls, and flush often so that server/client controls when to send results