IRC Log Viewer » #firebreath » 2016-08-24

IRC Nick Time (GMT-7) Message
gopi 11:08 hi anyone there
how can i convert FB::VariantList to FB::VariantMap and i need to convert_cast to string
when i convert variantlist to variantmap i get promise object from that how can i convert to string
please some one answer
clear
taxilian 12:08 gopi
you need to wait for it to resolve
well
where is it coming from?
actually.... gopi what are you even trying to do? there is no convert_cast from variantlist or variantmap to string
gopi 12:08 my requirement is i will get array of json value [{"key":"value"},{"key":"value"}] from javascript via argument in my function in c++ i need to extract value from it
how to do this
thanks for the response taxilian
taxilian 12:08 (I'm at work, so sometimes don't see messages right away, just FYI)
gopi: there is a jsoncpp library that you can add, I believe, which has a function which can do that
but convert_cast won't do it automatically for you
gopi 12:08 FB::VariantList& list; FB::variant val = list[0]; FB::VariantMap map = val.convert_cast<FB::VariantMap>(); std::string mdn = map["key"].convert_cast<std::string>();
this how i used to do previously before fb2.0
taxilian 12:08 convert_cast as asynchronous in FB2 because some operations require hitting up the browser. You can check .is_of_type<std::string>() and .cast<std::string>() to do it synchronously
gopi 12:08 oh ok thanks
one more doubt
taxilian 12:08 I gotta run to lunch, I'll be back a bit later; if you're quick I'll try to answer before I go
gopi 12:08 if i have FB::VariantMapPromise map
how will i extract the map value from it