JsonApi (deprecated)
danger
Since May 2025 this spec is considered deprecated.
The JsonApi
attestation type has been update to a new version, Web2Json
.
You can find the updated version of this spec here.
Data retrieval from Web2 JSON APIs with JQ transformations. This attestation type allows smart contracts to access and process external JSON data in a verifiable way.
Testnet Only
JsonApi attestation type is currently only available on Flare Testnet Coston2 and Songbird Testnet Coston.
Supported sources
Network Type | Sources |
---|---|
Web2 | WEB2 (Web 2.0 JSON APIs) |
Testnet | testWEB2 |
Request
Field | Solidity Type | Description |
---|---|---|
url | string | URL of the JSON API endpoint to query. |
postprocessJq | string | JQ filter expression to transform the retrieved JSON data. |
abi_signature | string | ABI signature defining the struct format for encoding the transformed JSON data. |
Response
Field | Solidity Type | Description |
---|---|---|
abi_encoded_data | bytes | ABI-encoded data result after JQ transformation. |
Verification Process
1. API Request
The attestation service performs a GET request to the specified url
.
- If the request fails or returns non-JSON data, the attestation request is rejected.
- The service validates that the response is valid JSON data.
2. JQ Transformation
The specified postprocessJq
filter is applied to the retrieved JSON:
- The JQ filter must be a valid JQ expression.
- The filter's output must match the structure defined in
abi_signature
. - If the JQ transformation fails, the attestation request is rejected.
3. ABI Encoding
The transformed data is ABI-encoded according to the provided abi_signature
:
- The encoding must match the Solidity ABI specification.
- The encoded bytes are returned in
abi_encoded_data
.