JSON
JSON (JavaScript Object Notation) is a text format for exchanging data in which values are grouped into objects in curly braces and arrays in square brackets. It is specified in RFC 8259 and the ECMA-404 standard, and its media type is application/json. Genesis API responds in JSON too.
Value types
| Type | Example | In Python |
|---|---|---|
| Object | {"coin": "BTC"} | dict |
| Array | [0.11, 0.45] | list |
| String | "ByBit" | str |
| Number | 214, 0.92 | int, float |
| Boolean | true, false | True, False |
| Empty value | null | None |
Field names and strings take double quotes only. JSON has no comments, and a comma after the last element makes the document invalid.
A Genesis API response
Hypothetical example of an /arbitrage/spot-spot endpoint response: one row, some fields omitted.
{
"success": true,
"data": [
{
"coin": "FUEL",
"exchange_buy": "ByBit",
"exchange_sell": "Gate",
"spread_pct": 0.11,
"deposit_enabled_buy": true,
"volume_24h_sell": null
}
],
"meta": {
"count": 1,
"updated_at": 1783802410,
"freshness_sec": 10,
"plan": "pro"
}
}
Every successful Genesis API response has the same shape: success is the success flag, data holds the data, and meta carries the item count, the unix time the data was built, the delivery delay on your plan in seconds and your plan. null in volume_24h_sell means no data, so do not treat it as zero. Details are in the Response format section.
Parsing in Python
import os
import requests
response = requests.get(
"https://api.genesisarbitrage.com/v1/arbitrage/spot-spot",
headers={"X-API-Key": os.environ["GENESIS_API_KEY"]},
params={"min_spread": 0.5},
timeout=10,
)
body = response.json() # JSON → dict
if not body["success"]:
print(body["error"]["code"], body["error"]["message"])
else:
for row in body["data"]:
vol = row["volume_24h_sell"] # null → None
vol = "n/a" if vol is None else f"${vol:,.0f}"
print(row["coin"], f"{row['spread_pct']}%", vol)
response.json() turns the response text into a Python dictionary. If the body is not JSON, for example a proxy error page, the method raises requests.exceptions.JSONDecodeError. A successful parse does not mean a successful request: Genesis API errors arrive as the same kind of JSON with "success": false and an error object, and the codes are in the Errors section.
See also: REST API, spread, response format, ETag and errors, lesson: your first API request with HTTP, headers and JSON.
Questions and answers
How do I convert updated_at to a date?
It is unix time in seconds. In Python, datetime.fromtimestamp(1783802410, timezone.utc) gives July 11, 2026, 20:40:10 UTC.