Re: [Cppcms-users] best way to create json output
Brought to you by:
artyom-beilis
From: kpeo <sla...@ya...> - 2015-09-30 06:24:17
|
<p>Hi!</p><p>It depends on your application and goals.<br /><br />The JSON-RPC server (asynchronous application) could be smoothly combined with synchronous application. See:<br /><a href="http://permalink.gmane.org/gmane.comp.lib.cppcms.user/580">http://permalink.gmane.org/gmane.comp.lib.cppcms.user/580</a><br /><a href="http://cppcms.com/wikipp/en/page/cppcms_1x_json_rpc">http://cppcms.com/wikipp/en/page/cppcms_1x_json_rpc</a></p><div>If you mean conversion from cppcms::json::value to string/stream/etc. - you can write something like</div><p>std::string json_to_string(cppcms::json::value const& v)<br />{<br /> std::ostringstream ss;<br /> if(!v.is_undefined())<br /> ss << v;<br /> return ss.str();<br />}</p><p>For json_rpc - you can just return the cppcms::json::value (i.e. "v"), like: <br />return_result(v);<br /><br /></p><div>Also you can look at examples/json_rpc_chat/chat.cpp and test/jsonrpc_test.cpp from CppCMS sources.</div><div><br />Best regards,<br />kpeo</div><p>30.09.2015, 06:18, "mawan sugiyanto" <<a href="mailto:ma...@gm...">ma...@gm...</a>>:</p><blockquote> Dear All<br /><br /> how to create json output ..<br /><br /> I have an alternatives for json ouput .. create json value and then ouput to the response<br /> or any other best way to create json ouput?<br /><br /> or it have to create rpc server, how if it combile with web application?<br /><br /> thanks ..<br /><br /> ,<br /><br /> ------------------------------------------------------------------------------<br /> ,<br /><br /> _______________________________________________<br /> Cppcms-users mailing list<br /> <a href="mailto:Cpp...@li...">Cpp...@li...</a><br /> <a href="https://lists.sourceforge.net/lists/listinfo/cppcms-users">https://lists.sourceforge.net/lists/listinfo/cppcms-users</a></blockquote> |