summaryrefslogtreecommitdiff
path: root/AK
diff options
context:
space:
mode:
authorTimothy Flynn <trflynn89@pm.me>2022-11-17 16:17:13 -0500
committerLinus Groh <mail@linusgroh.de>2022-11-18 12:21:57 +0000
commit5d61053276951e68f819d262de7b665b0751833c (patch)
tree18d7cc3e6d04b42ae816f26f9439f8623fd4238f /AK
parent13b18a182a13ecbfc703e4cef9175444b5519fcb (diff)
downloadserenity-5d61053276951e68f819d262de7b665b0751833c.zip
AK: Add mutable accessors for JsonValue's as_array and as_object
Diffstat (limited to 'AK')
-rw-r--r--AK/JsonValue.h12
1 files changed, 12 insertions, 0 deletions
diff --git a/AK/JsonValue.h b/AK/JsonValue.h
index 3d0f7e3c4a..a1a8f65be5 100644
--- a/AK/JsonValue.h
+++ b/AK/JsonValue.h
@@ -164,12 +164,24 @@ public:
}
#endif
+ JsonObject& as_object()
+ {
+ VERIFY(is_object());
+ return *m_value.as_object;
+ }
+
JsonObject const& as_object() const
{
VERIFY(is_object());
return *m_value.as_object;
}
+ JsonArray& as_array()
+ {
+ VERIFY(is_array());
+ return *m_value.as_array;
+ }
+
JsonArray const& as_array() const
{
VERIFY(is_array());