Commit graph

9 commits

Author SHA1 Message Date
Andreas Kling 5e164052f6 AK+Kernel: Escape JSON keys & values
Grab the escaping logic from JSON string value serialization and use
it for serializing all keys and values.

Fixes #3917.
2020-11-02 12:56:36 +01:00
Andreas Kling a1db1e6664 AK: Make JsonValue and JsonObjectSerializer speak int/long/long long
While width-oriented integer types are nicer from the programmer's
perspective, we have to accept that C++ thinks in int/long/long long.
2020-05-22 13:57:23 +02:00
Emanuel Sprung c54855682c AK: A few JSON improvements
* Add double number to object serializer

* Handle negative double numbers correctly

* Handle \r and \n in quoted strings independently
  This improves the situation when keys contain \r or \n that currently
  has the effect that "a\rkey" and "a\nkey" in an JSON object are the
  same key value.
2020-03-31 13:42:39 +02:00
Andreas Kling 745ea2a0ef AK: Add JsonObjectSerializer::add(key, bool) overload
Without this, bools will get implicitly converted to integers, which is
usually not what we want.
2020-02-08 02:48:27 +01:00
Andreas Kling 276b6a4372 AK: Add some integer overloads to JsonObjectSerializer
This avoids constructing a temporary JsonValue just to append an int.
2020-02-01 10:56:17 +01:00
Sergey Bugaev c0b32f7b76 Meta: Claim copyright for files created by me
This changes copyright holder to myself for the source code files that I've
created or have (almost) completely rewritten. Not included are the files
that were significantly changed by others even though it was me who originally
created them (think HtmlView), or the many other files I've contributed code to.
2020-01-24 15:15:16 +01:00
Andreas Kling 94ca55cefd Meta: Add license header to source files
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.
2020-01-18 09:45:54 +01:00
Andreas Kling cc98ea1956 Json: Add serializer fast-path for string values
Passing these through the generic JsonValue path was causing us to
instantiate temporary JsonValues that incurred a heap allocation.
This avoids that by adding specialized overloads for string types.
2019-09-04 14:40:11 +02:00
Sergey Bugaev 56f5c14d86 JSON: Add JSON serializers
These are two new types that allow serializing JSON on-the-fly
as it's generated, without building the whole JSON in memory
first.
2019-08-27 14:56:09 +02:00