JSON Datastores

DataNucleus supports persisting/retrieving objects to/from JSON datastores (using the datanucleus-json plugin). If you wish to help out development of this plugin either by contributing or by sponsoring particular functionality please contact us via the DataNucleus Forum.

Datastore Connection

The following persistence properties will connect to JSON at a URL


So you create your PersistenceManagerFactory or EntityManagerFactory with these properties. Thereafter you have the full power of the JDO or JPA APIs at your disposal, for your JSON datastore.


Access Platform allows you to query the objects in the datastore using the following

  • JDOQL - language based around the objects that are persisted and using Java-type syntax
  • JPQL - language based around the objects that are persisted and using SQL-like syntax

Mapping : HTTP Mapping

The persistence to JSON datastore is performed via HTTP methods. HTTP response codes are used to validate the success or failure to perform the operations. The JSON datastore must respect the following:

Method Operation URL format HTTP response code
PUT update objects /{primary key} HTTP Code 201 (created), 200 (ok) or 204 (no content)
HEAD locate objects /{primary key} HTTP 404 if the object does not exist
POST insert objects / HTTP Code 201 (created), 200 (ok) or 204 (no content)
GET fetch objects /{primary key} HTTP Code 200 (ok) or 404 if object does not exist
GET retrieve extent of classes (set of objects) / HTTP Code 200 (ok) or 404 if no objects exist
DELETE delete objects /{primary key} HTTP Code 202 (accepted), 200 (ok) or 204 (no content)

Mapping : Persistent Classes
Metadata API Extension Element Attachment Extension Description
JDO /jdo/package/class/extension url Defines the location of the resources/objects for the class
    <package name="org.datanucleus.samples.models.company">
        <class name="Person" detachable="true">
            <extension vendor-name="datanucleus" key="url" value="/Person"/>

In this example, the url extension identifies the Person resources/objects as /Person . The persistence operations will be relative to this path. e.g /Person/{primary key} will be used for PUT (update), GET (fetch) and DELETE (delete) methods.