JSONPlaceholder API Explorer
Browse and explore the free JSONPlaceholder REST API interactively
关于此工具
JSONPlaceholder is a popular free REST API used for testing and prototyping. This explorer lets you browse all six resources — posts, comments, albums, photos, todos, and users — without writing a single line of code. Filter by ID or parent resource, view the raw JSON response with syntax highlighting, see the exact API URL being called, and copy a ready-to-run fetch() snippet to your clipboard. Perfect for learning REST API concepts, demoing front-end code, or quickly grabbing sample data structures.
使用方法
- 1 Select a resource (posts, comments, albums, photos, todos, or users) from the tabs.
- 2 Optionally enter an ID to fetch a single record, or a parent ID to filter related items.
- 3 Click 'Fetch' to make the API request and view the JSON response.
- 4 Review the API URL shown above the response to understand the endpoint structure.
- 5 Click 'Copy fetch()' to get a ready-to-use JavaScript fetch snippet.
What JSONPlaceholder is for
JSONPlaceholder is a free, public REST API that serves realistic-looking fake data — posts, comments, albums, photos, todos, and users. It exists so developers can build and test something that talks to an API before the real backend is ready. Instead of inventing sample data or standing up a server, you point your code at a stable, predictable endpoint that always returns the same well-formed JSON. This explorer is a friendly front end to that API: it lets you click through all six resources, fire live requests, and copy a ready-made fetch() snippet, all without writing any code first.
The requests go to the real JSONPlaceholder service over the network, and the response — along with how long it took — is shown with JSON syntax highlighting.
The six resources and how they relate
| Resource | Items | What it represents |
|---|---|---|
| posts | 100 | Short blog-style posts, each with a userId |
| comments | 500 | Comments, each tied to a postId |
| albums | 100 | Photo albums, each with a userId |
| photos | 5,000 | Photos, each tied to an albumId |
| todos | 200 | To-do items with a completed flag |
| users | 10 | User profiles with nested address and company data |
These resources are deliberately linked the way a real database would be: a post has comments, an album has photos, and both belong to a user. That lets you practice the request patterns you will use against a production API — fetching a collection, fetching one item by ID, and following relationships between them.
A worked example
Select posts and click Fetch with the ID field empty. The explorer requests /posts and returns the full array of 100 items; the counter reads "100 items" and shows the round-trip time in milliseconds. Now type 1 into the ID box and fetch again: the URL becomes /posts/1 and you get a single object — one post with its id, userId, title, and body. The difference between those two calls — a collection versus a single resource addressed by ID — is the core of REST, and you can feel it here in one click.
Reading the generated fetch snippet
For whatever URL you have built, the tool generates a copyable snippet like fetch('https://jsonplaceholder.typicode.com/posts/1').then(res => res.json()).then(data => console.log(data)).catch(err => console.error(err));. This is real, working code you can paste into a browser console or a project. It demonstrates the standard promise chain: kick off the request, parse the body as JSON, do something with the data, and handle errors. The Copy URL button gives you just the endpoint if you would rather test it in curl or Postman.
The explorer also reports the response time in milliseconds and counts the items returned, which is a quiet but useful detail when you are learning. A request to a collection like /photos returns 5,000 objects and takes meaningfully longer than fetching a single record — seeing those two numbers side by side teaches you to fetch only what you need and to filter on the server rather than pulling everything and trimming in the browser.
Common use cases
- Prototyping a UI that lists items or shows a detail page, using fake-but-shaped data until the backend exists.
- Learning REST conventions — collections, single items by ID, and nested relationships — without setting anything up.
- Testing a frontend HTTP layer (fetch, Axios, React Query, and the like) against an endpoint that behaves consistently.
- Demos and tutorials where you need a reliable public API that never requires a key.
Tips and things to know
- It is read-friendly but not truly writable. JSONPlaceholder accepts POST, PUT, and DELETE requests and echoes back what a real server would return, but it does not actually persist your changes. A created item looks saved in the response yet will not appear on the next GET.
- Respect the ID ranges. Asking for a photo ID above 5,000 or a user above 10 returns an empty object. The explorer caps the ID input to each resource's maximum to keep you in range.
- Use query filters in real code. Beyond this explorer, the API supports filtering like
/comments?postId=1to fetch all comments for a post — the natural way to follow the relationships shown above. - It needs the network. Unlike fully offline tools, this one makes a live request, so a dropped connection produces an HTTP error rather than a result.