copied from jsoncpp