Re: [Cppcms-users] json serialization issue
Brought to you by:
artyom-beilis
|
From: Daniel V. <chi...@gm...> - 2013-01-10 00:41:30
|
Try with cppcms::json::object instead of std::map<string,
cppcms::json::value>.
On Wed, Jan 9, 2013 at 8:47 PM, Lee Elenbaas <lee...@gm...> wrote:
> can anyone point me to what i did wrong in this code:
>
> namespace cppcms {
> namespace json {
>
> template<typename V>
> struct traits<std::map<std::string,V>> {
> static std::map<std::string,V> get(const value& val) {
> std::map<std::string,V> m;
>
> for(auto p : val.object())
> m[p.first]=traits<V>::get(p.second);
>
> return m;
> }
> static void set(value& v, const std::map<std::string,V> m) {
> auto o = v.object();
>
> for(auto p : m) {
> o[p.first]=value(p.second);
> }
> }
> };
>
> } // namespace json
> } // namespace cppcms
>
> when i try to use this:
>
> std::map<string, cppcms::json::value> m;
> ...
> cppcms::json::value v(m);
>
> i get the bad_value_cast exception
>
> thanks
> lee
>
> --
> --
> lee
> Lee Elenbaas
> lee...@gm...
>
>
> ------------------------------------------------------------------------------
> Master Java SE, Java EE, Eclipse, Spring, Hibernate, JavaScript, jQuery
> and much more. Keep your Java skills current with LearnJavaNow -
> 200+ hours of step-by-step video tutorials by Java experts.
> SALE $49.99 this month only -- learn more at:
> http://p.sf.net/sfu/learnmore_122612
> _______________________________________________
> Cppcms-users mailing list
> Cpp...@li...
> https://lists.sourceforge.net/lists/listinfo/cppcms-users
>
>
|