Products
Last updated 2026-05-20
Copy-ready JSON for products: list with pagination, single product, search, category filter, add, update, and delete. Every snippet runs against the live /products endpoint.
Products
fetch('https://jsonexamples.com/products')
.then(res => res.json())
.then(console.log);Response
{
"products": [
{
"id": 1,
"title": "iPhone 9",
"description": "An apple mobile which is nothing like apple",
"price": 549,
"discountPercentage": 12.96,
"rating": 4.69,
"stock": 94,
"brand": "Apple",
"category": "smartphones",
"thumbnail": "...",
"images": ["...", "...", "..."]
}
// 30 items
],
"total": 100,
"skip": 0,
"limit": 30
}fetch('https://jsonexamples.com/products/1')
.then(res => res.json())
.then(console.log);Response
{
"id": 1,
"title": "iPhone 9",
"description": "An apple mobile which is nothing like apple",
"price": 549,
"discountPercentage": 12.96,
"rating": 4.69,
"stock": 94,
"brand": "Apple",
"category": "smartphones",
"thumbnail": "...",
"images": ["...", "...", "..."]
}fetch('https://jsonexamples.com/products/search?q=phone')
.then(res => res.json())
.then(console.log);Response
{
"products": [
{
"id": 1,
"title": "iPhone 9",
"price": 549,
"category": "smartphones"
// ...rest of product
}
// 4 results
],
"total": 4,
"skip": 0,
"limit": 4
}- Use
limitandskipfor pagination.limit=0returns all items. - Pass
selectwith comma-separated keys to trim the payload.
fetch('https://jsonexamples.com/products?limit=10&skip=10&select=title,price')
.then(res => res.json())
.then(console.log);Response
{
"products": [
{
"id": 11, // first 10 items skipped
"title": "perfume Oil",
"price": 13
}
// 10 items
],
"total": 100,
"skip": 10,
"limit": 10
}fetch('https://jsonexamples.com/products/categories')
.then(res => res.json())
.then(console.log);Response
[
"smartphones",
"laptops",
"fragrances",
"skincare",
"groceries",
"home-decoration",
"furniture",
"tops",
"womens-dresses",
"womens-shoes",
"mens-shirts",
"mens-shoes",
"mens-watches",
"womens-watches",
"womens-bags",
"womens-jewellery",
"sunglasses",
"automotive",
"motorcycle",
"lighting"
]fetch('https://jsonexamples.com/products/category/smartphones')
.then(res => res.json())
.then(console.log);Response
{
"products": [
{
"id": 1,
"title": "iPhone 9",
"category": "smartphones"
// ...
}
// 5 items
],
"total": 5,
"skip": 0,
"limit": 5
}- Adding a new product will not persist on the server.
- It simulates a POST and returns the newly created product with a fresh id.
fetch('https://jsonexamples.com/products/add', {
method: 'POST',
headers: { 'Content-Type': 'application/json' },
body: JSON.stringify({
title: 'BMW Pencil',
/* other product data */
})
})
.then(res => res.json())
.then(console.log);Response
{
"id": 101,
"title": "BMW Pencil"
/* other product data */
}- Updating a product will not persist on the server.
- It simulates a PUT/PATCH and returns the product with modified data.
/* updating title of product with id 1 */
fetch('https://jsonexamples.com/products/1', {
method: 'PUT', /* or PATCH */
headers: { 'Content-Type': 'application/json' },
body: JSON.stringify({
title: 'iPhone Galaxy +1'
})
})
.then(res => res.json())
.then(console.log);Response
{
"id": 1,
"title": "iPhone Galaxy +1", // only title was updated
"description": "An apple mobile which is nothing like apple",
"price": 549,
"discountPercentage": 12.96,
"rating": 4.69,
"stock": 94,
"brand": "Apple",
"category": "smartphones"
}DELETE
Delete a product
- Deleting a product will not persist on the server.
- It simulates a DELETE and returns the deleted product with
isDeletedanddeletedOn.
fetch('https://jsonexamples.com/products/1', { method: 'DELETE' })
.then(res => res.json())
.then(console.log);Response
{
"id": 1,
"title": "iPhone 9",
"description": "An apple mobile which is nothing like apple",
"price": 549,
"isDeleted": true,
"deletedOn": /* ISOTime */
}