React-Admin JSON Server Data Provider

5.14.5 · active · verified Sun Apr 19

ra-data-json-server is a data provider specifically designed to integrate `react-admin` applications with REST APIs that follow the conventions of JSON Server, including services like JSONPlaceholder. It translates `react-admin` data requests (e.g., `getList`, `getOne`, `create`) into standard HTTP requests compatible with a JSON Server backend. The package is currently at version 5.14.5 and is actively maintained, with frequent patch releases addressing bug fixes and minor improvements, usually on a weekly or bi-weekly basis, following the `react-admin` release cycle. A key differentiator is its strict adherence to JSON Server's REST dialect, simplifying setup for prototyping or light backend needs, and requiring specific HTTP headers like `X-Total-Count` for proper pagination.

Common errors

Warnings

Install

Imports

Quickstart

Initializes a `react-admin` application with `ra-data-json-server` connected to JSONPlaceholder, defining 'posts' and 'users' resources.

import * as React from 'react';
import { Admin, Resource } from 'react-admin';
import jsonServerProvider from 'ra-data-json-server';

// For demonstration purposes, we'll use a simple list component.
// In a real app, you'd define your own PostList.
const PostList = () => <div>Posts List (render your actual list here)</div>;

const App = () => (
    <Admin dataProvider={jsonServerProvider('https://jsonplaceholder.typicode.com')}>
        <Resource name="posts" list={PostList} />
        <Resource name="users" list={PostList} />
    </Admin>
);

export default App;

view raw JSON →