aboutsummaryrefslogtreecommitdiffstats
path: root/include/crow/json.h
diff options
context:
space:
mode:
Diffstat (limited to 'include/crow/json.h')
-rw-r--r--include/crow/json.h19
1 files changed, 18 insertions, 1 deletions
diff --git a/include/crow/json.h b/include/crow/json.h
index e2d116c..3d9ed18 100644
--- a/include/crow/json.h
+++ b/include/crow/json.h
@@ -1333,6 +1333,24 @@ namespace crow
return (*o)[str];
}
+ std::vector<std::string> keys() const {
+ std::vector<std::string> result;
+ switch (t_) {
+ case type::Null: return result;
+ case type::False: return result;
+ case type::True: return result;
+ case type::Number: return result;
+ case type::String: return result;
+ case type::List: return result;
+ case type::Object: {
+ for (auto& kv:*o) {
+ result.push_back(kv.first);
+ }
+ return result;
+ }
+ }
+ }
+
size_t estimate_length() const
{
switch(t_)
@@ -1373,7 +1391,6 @@ namespace crow
return 1;
}
-
friend void dump_internal(const wvalue& v, std::string& out);
friend std::string dump(const wvalue& v);
};