0

我可以使用 libjson 按名称获取对象吗?

我已经安装了 libjson。我很惊讶没有办法通过对象名称获取值。我将不得不编写自己的函数或者我错过了什么?

4

1 回答 1

0

If you are using the C++ library, the JSONNode class overloads the [] operator.

Per the docs:

JSONNode & operator [] (const json_string & name);
const JSONNode & operator [] (const json_string & name) const;

This will give you a reference to a child node either at a specific location or by it’s name. Asking for a
node that is not there will result in undefined behavior.
于 2014-03-26T19:20:14.573 回答