The KV format
The KV format is a key-value text format that’s basically JSON without the JavaScript compatibility.
In the KV format a KV value can be
- the keywords
true
,false
ornull
, - a simple value like
hello
, or a quoted string like"hello"
or'world'
. - a number.
- an array, starting with
[
and ending with]
, with a series of comma-separated values (trailing comma allowed). - an object, starting with
{
and ending with}
, with a series ofkey=value
fields (key can be a quoted string). (For compatibility with javascript,key:value
is also allowed).
A “simple key” is a key which does not need quoting, which means a non-empty key consisting of at most letters, numbers, periods, hyphens. A simple value can also include slashes.
Key-value data is a sequence of (simple key) key=value
pairs, terminated by anything
that doesn’t match the format.
This format is accepted at the top of any pardon .http
template and allows
us to specify values directly in-line with the request.
The main advantages of the KV format are
- less syntax than JSON (quotes can often be elided)
- trailing commas
- using
=
inside objects so that object contents can be copied to the top level.