---
url: https://gudhub.com/uk/docs/utils/json-to-item/jsontoitem-overview/
title: "jsonToItems\n                #"
description: "jsonToItems is a comfortable instrument for generating items. Namely, this method converts json to gudhub items. Created items can be used for generating new on"
lang: uk
updated: 2026-09-13T13:46:06.994Z
---

# jsonToItems [#](https://gudhub.com/uk/docs/utils/json-to-item/jsontoitem-overview/#jsontoitems)

**jsonToItems** is a comfortable instrument for generating items. Namely, this method converts json to gudhub items. Created items can be used for generating new ones.

Копіювати

```js
import GudHub from '@gudhub/core';
const AUTHKEY =  "KJGJsbjaSADAfskajlkmoiwuehyugT//ssefiooq0kd79uiohdwg2y81y";
const gudhub = await new GudHub(AUTHKEY);
const APPID = "27781";
const FIELDID = "645634";
let json = {
        "book": [
        {
                "category": "reference",
                "author": "Nigel Rees",
                "title": "Sayings of the Century",
                "price": 8.95
        }],
};

let fieldsMap = [{
        field_id: FIELDID,
        json_path : "$..author",
}];

//item generation
let items = gudhub.jsonToItems(json, fieldsMap);

// add new generated items in application
gudhub.addNewItems(APPID, items);
```

**jsonToItem** takes two objects as arguments. The first one is a source code from that the data will be taken. The second, roughly speaking, is a model by which items are generated.

| Name | Type | Description |
| :-- | :-- | :-- |
| json | `object` | _json that is going to be converted to gudhub items_ |
| fieldsMap | `object` | _object in json format which contains instructions of how to convert to items_ |

The method returns items list of objects with required data:

Копіювати

```json
[{
    "fields":{
            "field_id": 12356,
            "field_value": "test value"
            }
    },
    {
    "fields":{
            "field_id": 12356,
            "field_value": "test value2"
            }
}, ...]
```

We suggest you to get to know more about jsonToItem method in tutorial.

## fieldsMap [#](https://gudhub.com/uk/docs/utils/json-to-item/jsontoitem-overview/#fieldsmap)

The process of the conversation is based on fieldsMap. It is an array of objects. Each of them contains two properties with such values as field ID and [JSONPath query](https://gudhub.com/uk/docs/utils/json-to-item/jsonpath/). Due to this information method gets required data from relevant field. It uses JSONPath to parse JSON.

Копіювати

```js
[{
        field_id: 431,
        json_path : "$..item_id"
   },
   {
        field_id: 431,
        json_path : "$..item_id"
},...]
```
