卡萨布兰卡问题检索json [英] Casablanca question retrieving json
问题描述
大家好,只是将我的脚趾浸入卡萨布兰卡世界并需要一些使用json :: value对象的帮助 - 我已经调用了一个服务器,该服务器返回JSON并在jsonValue中拥有我想要的数据,如下所示 - 我需要的元素是结果,我无法理解如何将它从集合中删除 - 我尝试了自动myres = jsonValue [3],它给出了一个错误,没有运算符[]匹配这些操作数 - 任何想法?
Hi all, just dipping my toes into the Casablanca world and need some help working with json::value objects - I've made a call to a server which returns JSON and have the data I want in jsonValue as shown below - the element I need is "result" and I can't fathom out how to get it out of the collection - I've tried auto myres = jsonValue[3] which gives an error no operator "[]" matches these operands - any ideas ?
jsonValue dump
object {size = 4}
[0]: (L"id", 1)
[1]: (L"method", 0x0047c694 L"slim.request")
[2]: (L"params", array {size = 2})
[3]: (L"result", object {size = 11})
[Raw View]: 0x0282f0c0 {m_value=unique_ptr {m_object={size = 4} } m_kind=Object(3) }
我的尝试:
我试过的问题是
What I have tried:
What I've tried is in the question
推荐答案
auto objValue=dump[_T("result")].as_object()
参见 Casablanc docs [ ^ ]
这篇关于卡萨布兰卡问题检索json的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!