bool InboundJSONCLIProtocol::SendMessage(Variant &message) {
	string json;
	if (!message.SerializeToJSON(json)) {
		FATAL("Unable to serialize to JSON");
		return false;
	}
	json += "\r\n";
	if (_useLengthPadding) {
		uint32_t size = EHTONL((uint32_t) json.length());
		_outputBuffer.ReadFromBuffer((uint8_t *) & size, 4);
	}
	_outputBuffer.ReadFromString(json);
	return EnqueueForOutbound();
}
Example #2
0
bool JsonVariantProtocol::Serialize(string &rawData, Variant &variant) {
    return variant.SerializeToJSON(rawData);
}