New implementation of toJSONstat
Test round-trip
Test output