Skip to content

The KV format

The KV format is a key-value text format that’s a reduced version of JSON.

KV usually consists of zero or more “{key}={value}” entries, where value is in a relaxed JSON format:

  • values can be the keywords true, false or null,
  • most other strings can be left unquoted (without spaces or KV delimiters, which are commas, colons, equals signs, or [] and {} characters). Both single and double quotes are supported.
  • colons and equals signs are even allowed in unquoted strings in a value context.
  • colon as the field/value separator in objects can be (and this is encouraged) replaced by =.
  • and and all commas are optional, and trailing commas are supported (but repeated commas are not allowed).
  • trailing commas are supported.

KV is designed to terminate parsing when non-KV data follows it. For example, kv values can preceed an HTTP request because GET is not followed by =.

a=b
c=d
GET https://example.com

This format is accepted at the top of any pardon .http template and allows us to specify values directly above the request without additional syntax.

The main advantages of the KV format are

  • less syntax than JSON (quotes can be elided in many cases, commas in all cases).
  • Human readable - easy to read and write.
  • JSON compatible values - easy to generate

Try experimenting here