JSON开源库API【转载】https://nlohmann.github.io/json/index.html

API网址:https://nlohmann.github.io/json/index.html

源码网址:https://github.com/nlohmann/json

这些页面包含JSON for Modern C ++的API文档,这是一个C ++ 11仅限标头的JSON类。

内容

容器功能概述

从STL已知的容器函数已经扩展为支持JSON中的不同值类型。但是,并非所有函数都可以应用于所有值类型。请注意,某些功能的签名在类型之间有所不同; 例如,at可以使用字符串来调用对象中的键或使用整数来寻址数组中的值。

请注意,此表仅列出由于类型而引发的异常。例如,当调用字符串类型时,该at 函数将始终抛出json::type_error 异常。当调用数组时,如果传递的索引无效,它可能会抛出json::out_of_range 异常。

功能JSON值类型
宾语排列布尔空值
迭代器 begin begin begin begin begin begin begin (退货end()
cbegin cbegin cbegin cbegin cbegin cbegin cbegin (退货cend()
end end end end end end end
cend cend cend cend cend cend cend
rbegin rbegin rbegin rbegin rbegin rbegin rbegin
crbegin crbegin crbegin crbegin crbegin crbegin crbegin
rend rend rend rend rend rend rend
crend crend crend crend crend crend crend
元素
访问
at at at 投掷json::type_error(304) 投掷json::type_error(304) 投掷json::type_error(304) 投掷json::type_error (304)
operator[] operator[] operator[] 投掷json::type_error(305) 投掷json::type_error(305) 投掷json::type_error(305) operator[] (创建对象)
operator[] (创建数组)
front front front front front front 投掷json::invalid_iterator(214)
back back back back back back 投掷json::invalid_iterator(214)
容量 empty empty empty empty (退货false empty (退货false empty (退货false empty (退货true
size size size size (退货1 size (退货1 size (退货1 size (退货0
max_size_ max_size max_size max_size (退货1 max_size (退货1 max_size (退货1 max_size (退货0
修饰符 clear clear clear clear clear clear clear
insert 投掷json::type_error(309) insert 投掷json::type_error(309) 投掷json::type_error(309) 投掷json::type_error(309) 投掷json::type_error (309)
erase erase erase erase (转换为null) erase (转换为null) erase (转换为null) 投掷json::type_error (307)
push_back push_back push_back 投掷json::type_error(308) 投掷json::type_error(308) 投掷json::type_error(308) push_back (创建对象)
push_back (创建数组)
emplace / emplace_back emplace emplace_back 投掷json::type_error(311) 投掷json::type_error(311) 投掷json::type_error(311) emplace (创建对象)
emplace_back (创建数组)
update update 投掷json::type_error(312) 投掷json::type_error(312) 投掷json::type_error(312) 投掷json::type_error(312) 投掷json::type_error (312)
swap swap swap swap swap swap swap
抬头 find find find (退货end() find (退货end() find (退货end() find (退货end() find (退货end()
count count count (退货0 count (退货0 count (退货0 count (退货0 count (退货0
contains contains contains (退货false contains (退货false contains (退货false contains (退货false contains (退货false

 

原文地址:https://www.cnblogs.com/cy1993/p/11305404.html