json: fix C++ syntax, make copy constructor safe to fail