New implementation of toJSONstat
Test round-trip