summaryrefslogtreecommitdiff
path: root/AK/JsonArray.h
AgeCommit message (Collapse)Author
2023-05-09AK: Remove `must_set()` from `JsonArray`Kemal Zebari
Due to 582c55a, both `must_set()` and `set()` should be providing the same behavior. Not only is that a reason to remove `must_set()`, but it also performs erroneous behavior since it inserts an element at a specified index instead of modifying an element at that index.
2023-05-03AK: Have `JsonArray::set()` change values instead of inserting valuesKemal Zebari
Resolves #18618. 8134dcc changed `JsonArray::set()` to insert elements at an index instead of changing existing elements in-place. Since no behavior such as `Vector::try_at()` exists yet, it returns nothing.
2023-04-24AK: Add new failable `JsonArray::{append/set}` functionsCameron Youell
Move all old usages to the more explicit `JsonArray:must_{append/set}`
2023-01-27AK: Remove StringBuilder::build() in favor of to_deprecated_string()Linus Groh
Having an alias function that only wraps another one is silly, and keeping the more obvious name should flush out more uses of deprecated strings. No behavior change.
2022-12-06Everywhere: Rename to_{string => deprecated_string}() where applicableLinus Groh
This will make it easier to support both string types at the same time while we convert code, and tracking down remaining uses. One big exception is Value::to_string() in LibJS, where the name is dictated by the ToString AO.
2022-12-06AK+Everywhere: Rename String to DeprecatedStringLinus Groh
We have a new, improved string type coming up in AK (OOM aware, no null state), and while it's going to use UTF-8, the name UTF8String is a mouthful - so let's free up the String name by renaming the existing class. Making the old one have an annoying name will hopefully also help with quick adoption :^)
2022-11-26AK: Make it possible to not `using` AK classes into the global namespaceAndreas Kling
This patch adds the `USING_AK_GLOBALLY` macro which is enabled by default, but can be overridden by build flags. This is a step towards integrating Jakt and AK types.
2022-11-18AK: Add JSON object/array for-each methods for fallible callbacksTimothy Flynn
This allows the provided callback to return an ErrorOr-like type to propagate errors back to the caller.
2022-11-13AK: Support taking JSON values out of a JSON arrayTimothy Flynn
2022-02-27Everywhere: Make JSON serialization fallibleIdan Horowitz
This allows us to eliminate a major source of infallible allocation in the Kernel, as well as lay down the groundwork for OOM fallibility in userland.
2022-01-28AK: Allow constructing a JsonArray from any array-like typekleines Filmröllchen
2021-12-15AK: Add implied const qualifiers to the Json interfaceHendiadyoin1
As specified by clang-tidy.
2021-06-29AK: Use [[nodiscard]] in JsonObject and JsonArrayMax Wipfli
2021-06-29AK+Everywhere: Change int to size_t in JsonObject and JsonArrayMax Wipfli
2021-06-29AK: Use east const style in Json{Array,Object}.hMax Wipfli
2021-04-26AK: Fix argument type for JsonArray::at and JsonArray::operator[]Gunnar Beutner
2021-04-22Everything: Move to SPDX license identifiers in all files.Brian Gianforcaro
SPDX License Identifiers are a more compact / standardized way of representing file license information. See: https://spdx.dev/resources/use/#identifiers This was done with the `ambr` search and replace tool. ambr --no-parent-ignore --key-from-file --rep-from-file key.txt rep.txt *
2021-03-26AK: Allow assigning a value to a specific index in a JsonArrayTimothy Flynn
2021-01-15AK: Add JsonArray(const Vector<T>) constructorLinus Groh
This simplifies creating a JsonArray from a Vector<T> (when there's a JsonValue(T) constructor overload for T, that is).
2021-01-12AK: Simplify constructors and conversions from nullptr_tLenny Maiorani
Problem: - Many constructors are defined as `{}` rather than using the ` = default` compiler-provided constructor. - Some types provide an implicit conversion operator from `nullptr_t` instead of requiring the caller to default construct. This violates the C++ Core Guidelines suggestion to declare single-argument constructors explicit (https://isocpp.github.io/CppCoreGuidelines/CppCoreGuidelines#c46-by-default-declare-single-argument-constructors-explicit). Solution: - Change default constructors to use the compiler-provided default constructor. - Remove implicit conversion operators from `nullptr_t` and change usage to enforce type consistency without conversion.
2020-09-25Meta+AK: Make clang-format-10 cleanBen Wiederhake
2020-03-06AK: Simplify JsonObject and JsonArray API a little bitAndreas Kling
Instead of set(const JsonValue&) and set(JsonValue&&), just do set(JsonValue) and let callers move() if they want. This removes some ambiguity and the compiler is smart enough to optimize it anyway.
2020-01-18Meta: Add license header to source filesAndreas Kling
As suggested by Joshua, this commit adds the 2-clause BSD license as a comment block to the top of every source file. For the first pass, I've just added myself for simplicity. I encourage everyone to add themselves as copyright holders of any file they've added or modified in some significant way. If I've added myself in error somewhere, feel free to replace it with the appropriate copyright holder instead. Going forward, all new source files should include a license header.
2019-10-23AK: Add JsonArray::ensure_capacity()Andreas Kling
This is helpful for anyone who knows up-front how many items are gonna be appended to the JsonArray.
2019-08-27JSON: Port JsonArray and JsonObject serialization to serializersSergey Bugaev
This way, primitive JsonValue serialization is still handled by JsonValue::serialize(), but JsonArray and JsonObject serialization always goes through serializer classes. This is no less efficient if you have the whole JSON in memory already.
2019-08-07JSON: Templatize the JSON serialization codeAndreas Kling
This makes it possible to use something other than a StringBuilder for serialization (and to produce something other than a String.) :^)
2019-08-04Json: Add efficient copy and move constructors for Json{Array,Object}Andreas Kling
This helps avoid copying JsonValues during parsing.
2019-08-04JsonArray: Expose the value vector to the outside for convenienceAndreas Kling
Sometimes it's easier to just work with a const Vector<JsonValue>&, so give clients the option of doing that.
2019-06-24JsonArray: Add for_each() helper.Andreas Kling
2019-06-18AK: Rename JsonObject::to_string() and pals to serialized().Andreas Kling
And the variant that serializes into a StringBuilder is called serialize().
2019-06-17AK: Use a single StringBuilder throughout JSON serialization.Andreas Kling
2019-06-17AK: Add some classes for JSON encoding.Andreas Kling
This patch adds JsonValue, JsonObject and JsonArray. You can use them to build up a JsonObject and then serialize it to a string via to_string(). This patch only implements encoding, no decoding yet.