# Structure, Array and ValueTable to JSON in 1C: both directions

Source: https://checkcraft.ru/en/guides/1c-json-value-table.html · updated 2026-11-24

How to convert a Structure, Array and ValueTable to JSON and back in 1C: why WriteJSON does not accept a ValueTable…

Practical workflow

Checkcraft is a desktop app for checking APIs and logs without code, with a free edition. [Download, no sign-up →](https://checkcraft.ru/en/download-checkcraft.html#free-download)

WriteJSON understands Structure, Map, Array and simple types, but not a ValueTable directly. So the table is first turned into an array of structures, and when reading it is rebuilt from the array. Below are ready functions for both directions and the pitfalls with types and dates.

Checkcraft · 24 November 2026

Get help with your first test →

## Which 1C types go to JSON

Written directly: Structure and Map with string keys become an object, Array becomes an array, String, Number, Boolean and Undefined becomes null, Date with serialization settings. ValueTable, references to catalogs and documents and ValueStorage are not written directly: convert them to simple types first.

## ValueTable to JSON

Walk the table rows, create a Structure with the columns for each row, then write the resulting Array. Column names become JSON keys. Replace references with a code, a name or a UUID, otherwise the receiver cannot understand the value.

Repeating checks like this by hand? Checkcraft saves them and reruns them in one click. [Download Free →](https://checkcraft.ru/en/download-checkcraft.html#free-download)

## JSON array to ValueTable

Read the JSON into an Array of Maps, create a ValueTable with the needed columns and types, and add a row for each array element, filling columns by key. Set types explicitly: JSON numbers arrive as Number and dates as strings unless listed when reading.

## ValueTable to a JSON string

```
Функция ТаблицаВJSON(Таблица)
    Массив = Новый Массив;
    Колонки = Новый Массив;
    Для Каждого Колонка Из Таблица.Колонки Цикл
        Колонки.Добавить(Колонка.Имя);
    КонецЦикла;
    Для Каждого Строка Из Таблица Цикл
        Элемент = Новый Структура;
        Для Каждого Имя Из Колонки Цикл
            Элемент.Вставить(Имя, Строка[Имя]);
        КонецЦикла;
        Массив.Добавить(Элемент);
    КонецЦикла;
    Запись = Новый ЗаписьJSON;
    Запись.УстановитьСтроку();
    ЗаписатьJSON(Запись, Массив);
    Возврат Запись.Закрыть();
КонецФункции
```

If columns hold references, replace them with a code or UUID before writing, for example String(Ref.UUID()). Otherwise WriteJSON fails with an unsupported type error.

## JSON array to a ValueTable

```
Функция JSONВТаблицу(СтрокаJSON)
    Чтение = Новый ЧтениеJSON;
    Чтение.УстановитьСтроку(СтрокаJSON);
    Массив = ПрочитатьJSON(Чтение, Истина); // массив соответствий
    Чтение.Закрыть();

    Таблица = Новый ТаблицаЗначений;
    Таблица.Колонки.Добавить("sku", Новый ОписаниеТипов("Строка"));
    Таблица.Колонки.Добавить("qty", Новый ОписаниеТипов("Число"));
    Для Каждого Элемент Из Массив Цикл
        Строка = Таблица.Добавить();
        Строка.sku = Элемент.Получить("sku");
        Строка.qty = Элемент.Получить("qty");
    КонецЦикла;
    Возврат Таблица;
КонецФункции
```

Columns and types are set explicitly. The table then does not depend on which keys arrived in a given response, and extra partner fields do not break processing.

## What becomes what

| 1C | JSON | Back to 1C |
|---|---|---|
| Structure | object | Structure or Map |
| Array | array | Array |
| ValueTable | not directly, array of objects via a function | Array, then a table by hand |
| Reference | not directly, code or UUID string | Lookup by code or UUID |
| Date | ISO string with settings | String, or Date when fields are listed |

Reading and writing JSON in 1C is covered in [JSON in 1C](https://checkcraft.ru/en/guides/1c-json.html).

## More on 1C

Section overview and all guides: [1C integration via API: options, architecture and examples](https://checkcraft.ru/en/guides/1c-api-integration.html).

- [Data exchange in 1C: methods, formats, setup and checks](https://checkcraft.ru/en/guides/1c-data-exchange.html)
- [Integrating 1C with a website and online store: options and pitfalls](https://checkcraft.ru/en/guides/1c-site-integration.html)
- [Automated testing in 1C: Vanessa Automation, YAxUnit and integration checks](https://checkcraft.ru/en/guides/1c-automated-testing.html)
- [REST API in 1C: HTTP services, OData and calling external APIs](https://checkcraft.ru/en/guides/1c-rest-api.html)
- [1C HTTP services: create, publish, test and debug with examples](https://checkcraft.ru/en/guides/1c-http-service.html)

Next step

## Repeat this on your own API

Checkcraft is a desktop app that saves API response checks without code and shows what did not match. Start with a sample, then use your own sanitized data. Free runs on Windows and Linux with no time limit.

[Download Free](https://checkcraft.ru/en/download-checkcraft.html#free-download) · [Download and first run](https://checkcraft.ru/en/download-checkcraft.html)

No sign-up or email needed, the archive is ready in a couple of minutes. See the [edition limits](https://checkcraft.ru/en/pricing.html).

## References

[RFC 8259: the JSON format](https://www.rfc-editor.org/rfc/rfc8259)

## Continue with a related task

[JSON in 1C:Enterprise: read, write, HTTP requests and common errors](https://checkcraft.ru/en/guides/1c-json.html) · [Unexpected character when reading JSON in 1C: causes and fixes](https://checkcraft.ru/en/guides/1c-json-unexpected-character.html) · [1C HTTP services: create, publish, test and debug with examples](https://checkcraft.ru/en/guides/1c-http-service.html) · [Validate every element of a JSON array](https://checkcraft.ru/en/guides/json-array-validation.html)

Start with the linked example and compare its result with your own test requirement.

Ask a person

## Get help with your first test

Tell us what you want to test or where you got stuck. We can help you start Checkcraft, choose an example and understand your first run. You can ask before downloading.

[Ask in Telegram](https://t.me/checkcraftchat)Send an email

The Telegram group is public: do not post passwords, tokens or confidential work data. A description of your task is enough to start.

You can also email us support@checkcraft.ru

Page card: /ai/pages/en/guides/1c-json-value-table.md
