Trace Pagination Cursors in a Fictional API Response

Follow a response envelope from records to pagination metadata, using tree paths and raw output to confirm a cursor handoff.

By DevSphere Editorial · · 5 min read

Open JSON Viewer

Separate records from navigation data

When an API returns both a record array and pagination metadata, it is easy to confuse an item identifier with a continuation cursor. JSON Viewer is a practical inspection surface for separating these branches. It parses an entered JSON value, displays nested containers, supports search highlighting, and lists quick-access paths. It does not issue HTTP requests, follow a cursor, or know an API's pagination contract. Use a fictional response with invented records and a plainly fake token. The task is to verify the response shape before a sample client maps it into its own model. Write down which field means the next page and whether a null cursor signals the end. Those decisions must come from the API documentation, not from the names alone. A path review helps confirm that the data sample matches the intended shape, while a separate contract test should enforce it.

{
  "results": [{"ref": "demo-A", "label": "First"}, {"ref": "demo-B", "label": "Second"}],
  "pageInfo": {"hasMore": true, "nextCursor": "cursor-demo-02"},
  "count": 2
}

Locate each envelope branch

Paste the response into the JSON Input editor and check that JSON Viewer reports Valid JSON. Expand results to see the two array positions, then expand pageInfo separately. This visual separation makes it clear that results[0].ref is a record reference, while pageInfo.nextCursor is navigation metadata. The Quick Access Paths list may include paths for both positions; it only lists the first twenty and cannot be configured to show a selected subtree. Search for cursor-demo-02 to find the cursor value quickly, then inspect the parent and sibling hasMore field. The viewer highlights a match rather than filtering the tree, so keep the full context visible. If the response includes nested objects under each result, collapse those record branches while checking pageInfo; then reopen them to check the content. The Expand All and Collapse All controls reset broad tree visibility but don't modify the JSON.

Check cardinality and cursor meaning

For the sample, count two result objects, confirm count is numeric two, and check that hasMore is the boolean true. Confirm nextCursor is a string and is located under pageInfo, not under either result. The statistics below the viewer report total arrays, objects, keys, and scalar types; they can be a quick consistency aid but are not an automated comparison between count and results.length. The path listing uses dot notation for object keys and bracket indices for arrays, which makes the intended locations readable. It is not a standards-complete JSONPath implementation and accepts no filtering or wildcards. A cursor can be opaque; do not infer its contents, modify it, or assume it is safe to expose simply because a tutorial uses a fake value. In a real response, follow your data-handling policy before pasting. Keep examples invented and avoid access tokens or user identifiers.

results[0].ref -> "demo-A"
results[1].ref -> "demo-B"
pageInfo.hasMore -> true
pageInfo.nextCursor -> "cursor-demo-02"

Inspect exact text and formatting

Raw view is useful if a copied response contains a line break or spelling difference in nextCursor. Formatted view provides two-space indentation and exposes array boundaries, while the Copy Formatted and Copy Minified buttons copy serialized versions of the parsed data. Format and Minify also replace the input text with those representations. Formatting can make a diff easier to read, but reserialization is not byte preservation: whitespace and escaping may change, and object key ordering should not be treated as an API promise. The displayed count value remains a JSON number when normalized; a quoted "2" would be a string and should be checked against the contract. The tool cannot determine whether a cursor has expired or whether hasMore contradicts server state. Use an API client or test fixture for those operational questions and let this page answer only the structural inspection question.

Troubleshoot and close the review

If no tree appears, check the status before investigating paths. JSON syntax errors such as a trailing comma or a missing quote prevent parsing; correct the source and verify the status changes to Valid JSON. If a path is absent, confirm capitalization and nesting. Search results are highlights, not filters, and the path list truncates after twenty entries, so absence from that list does not prove absence from the object. For the sample, independently verify two records, count 2, hasMore true, and pageInfo.nextCursor equal to cursor-demo-02. Then compare each fact with the API's published contract; the viewer cannot establish which cursor value a server should return. Clear the content before another response. Use a schema or integration test for durable enforcement, especially when clients depend on cursor nullability or array cardinality. A visual inspection catches human-readable shape issues; it is not a substitute for regression testing.

When comparing pages, also check whether count means records on this page or total records across all pages; a field name alone is ambiguous. The sample sets it to two because there are two visible results, but a real service may report a larger total while hasMore remains true. That is a contract question, not a discrepancy the tree can resolve. If nextCursor is null on the final page, test that terminal case separately because a string in one sample does not reveal the allowed type union. Preserve the cursor as an opaque value; do not decode or alter it. A client test should request the next page using a controlled fake cursor and confirm duplicate or missing records are handled correctly. This manual inspection is best for checking a fixture's hierarchy before those tests are written.

Browse all tutorials