JSONqa: Query Attributes

HTTP uses query strings (?page=5) and fragments (#section) to pass client-side parameters. HPPR coordinates don’t have these—but JSONqa fills the gap.

The Problem

HPPR coordinates identify packets:

//docs/manual/chapter-3

But applications often need to pass extra information that isn’t part of the stored data: pagination, scroll position, filter settings. HTTP handles this with ?page=5&filter=active#results, but that syntax doesn’t fit HPPR’s coordinate model.

The Solution

JSONqa appends a JSON-like suffix to coordinates:

//docs/manual/chapter-3{page:5,#:results}

The {...} portion is purely client-side metadata—it’s not part of the coordinate for storage or fetching.

Syntax

{page:5}                    // key-value pair
{#:section}                 // fragment (scroll target)
{tags:[a,b,c]}              // array
{opts:{dark:1}}             // nested object
{draft}                     // flag (empty string value)
{name:"hello world"}        // quoted string with spaces
{key:a\:b}                  // escaped colon in value

Characters that need escaping: { } [ ] , : \ " '

JavaScript API

// Parse a URC with JSONqa
const urc = new URC("//docs/manual/page{#:section,page:5}");
urc.fragment    // "section"
urc.qa          // { "#": "section", page: "5" }

// Modify and serialize
urc.qa = { "#": "intro", page: "10" };
urc.href        // "//docs/manual/page{#:intro,page:10}"

The Address class delegates to its inner URC for JSONqa access.

Comparison with HTTP

HTTP JSONqa Notes
?page=5 {page:5} Simple parameter
?a=1&b=2 {a:1,b:2} Multiple parameters
#section {#:section} Fragment/anchor
?tags=a&tags=b {tags:[a,b]} Array (cleaner syntax)
?opts[dark]=1 {opts:{dark:1}} Nested (native support)