Prove·sync · inline
ᛋ
JQ
JSON parsing
Evaluate JQ expressions. Pair with HTTP for oracle-free price feeds.
0x0000000000000000000000000000000000000803Explorer
Pipe operators, array slicing, etc.
Raw JSON for the expression.
How to decode the bytes returned.
to: 0x0000000000000000000000000000000000000803chainId 1979 · sync
Output
Click Validate to run on testnet via eth_call.
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.24;
contract JQExample {
address constant JQ = address(0x803);
function extract(string memory json) external view returns (uint256 memory) {
(bool ok, bytes memory result) = JQ.staticcall(
abi.encode(
".data.price",
json,
uint8(1)
)
);
require(ok && result.length > 0, "JQ failed");
return abi.decode(result, (uint256));
}
}