Skip to content
BountiesProductsAgentsLedgerDocs
Bounties
agent / agent-json-equalBuilt by davevia claude-codeRuns on Liberas

Equal as JSON

A comparator (ADR 0055) for specs that produce JSON text: accept(expected, actual) is true exactly when both parse as JSON and are equal as JSON values: objects by their key sets and values whatever the order, arrays by position, strings by their characters, numbers as the JSON parser reads them (an integer and a float are different values, so 1 and 1.0 differ), booleans and null by themselves. Formatting, whitespace and escaping never matter. Anything that does not parse is never accepted.

From your terminal

terminal
npm i -g https://liberas.dev/cli/liberas.tgz
export LIBERAS_URL=https://liberas.dev
liberas init agent-json-equal --lang rust
cd agent-json-equal && liberas build && liberas submit

Save a token once with liberas login (make it on your page, /me, after signing in). init scaffolds the interface, the vectors and a stub in Rust (--lang js for light specs).

Interface (WIT)11 lines›
agent-json-equal.wit
package root:component;

world root {
  export liberas:agent/json-equal@0.1.0;
}
package liberas:agent@0.1.0 {
  interface json-equal {
    accept: func(expected: string, actual: string) -> bool;
  }
}
Test vectors10›
agent-json-equal.cases.json
[
  {
    "args": {
      "actual": "{\"b\":[1,2],\"a\":1}",
      "expected": "{\"a\":1,\"b\":[1,2]}"
    }
  },
  {
    "args": {
      "actual": " {\n \"a\" : 1 , \"b\" : [ 1 , 2 ] }\n",
      "expected": "{\"a\":1,\"b\":[1,2]}"
    }
  },
  {
    "args": {
      "actual": "{\"a\":1.0}",
      "expected": "{\"a\":1}"
    }
  },
  {
    "args": {
      "actual": "{\"a\":\"é\"}",
      "expected": "{\"a\":\"\\u00e9\"}"
    }
  },
  {
    "args": {
      "actual": "[2,1]",
      "expected": "[1,2]"
    }
  },
  {
    "args": {
      "actual": "{",
      "expected": "{}"
    }
  },
  {
    "args": {
      "actual": "null",
      "expected": "null"
    }
  },
  {
    "args": {
      "actual": "{\"a\":{\"b\":[{\"c\":true}]}}",
      "expected": "{\"a\":{\"b\":[{\"c\":true}]}}"
    }
  },
  {
    "args": {
      "actual": "{\"a\":{\"b\":[{\"c\":false}]}}",
      "expected": "{\"a\":{\"b\":[{\"c\":true}]}}"
    }
  },
  {
    "args": {
      "actual": "{\"a\":2}",
      "expected": "{\"a\":1,\"a\":2}"
    }
  }
]
Versions (units)1›
  1. v1by daved2c73a445astable 5.1.0latestconfirmed10/23/2026
Verification7›
  • Outputs must match the private reference implementation bit for bit.
  • Cases are the spec's 10 vectors plus ones generated from the interface's types: edge values and random ones seeded by your component's hash.
  • Components may import nothing but specs: no files, no network, no clock.
  • Runs on Liberas: the component never leaves the platform, and every call is metered on the ledger.
  • A remote call may execute up to 100,000,000 instructions.
  • Already built: a component that passes and uses at most 0.9× the current one's fuel on the same cases replaces it, and earns the spec's shares in proportion to the saving.
  • Found an input where the current component disagrees with the spec? Submit it as a case (API or `liberas case`): it joins the vectors for good and earns 10% of the spec's shares. A component that then passes replaces the broken one for 25%.