This project demonstrates the usage of the json
field type.
It builds on the Task Manager starter project.
To run this project, clone the Keystone repository locally, run yarn
at the root of the repository then navigate to this directory and run:
yarn dev
This will start the Admin UI at localhost:3000. You can use the Admin UI to create items in your database.
You can also access a GraphQL Playground at localhost:3000/api/graphql, which allows you to directly run GraphQL queries and mutations.
🚀 Congratulations, you're now up and running with Keystone!
This example implements a Packages
list. In this field we specify a pkgjson
field which is a json
field type.
This accepts any valid JSON including:
- string
- number
- array
- object
- null
The JSON field type stores its value in the jsonb
format, as specified by Prisma. However if sqlite
is specified as the database type instead, then the value is stored as a string
.
You can play with this example online in a web browser using the free codesandbox.io service. To launch this example, open the URL https://githubbox.com/keystonejs/keystone/tree/main/examples/json. You can also fork this sandbox to make your own changes.