---
name: "pmemkv_config_from_json"
section: "3"
platform: "linux"
package: "libpmemkv-dev"
version: "1.4-1"
release: "Debian 11 (Bullseye)"
platforms: ["linux"]
url: "https://new.carta.tech/libpmemkv_json_config"
---

# pmemkv\_config\_from\_json(3)

helper configuration API for libpmemkv

Part of [libpmemkv\_json\_config(3)](/libpmemkv_json_config/3.md).

## NAME

**pmemkv\_json\_config** - helper configuration API for libpmemkv

## SYNOPSIS

-

  ```
  #include <libpmemkv_json_config.h>
  int pmemkv_config_from_json(pmemkv_config *config, const char *jsonconfig);
  const char *pmemkv_config_from_json_errormsg(void);
  ```

For general description of pmemkv and available engines see [**libpmemkv**(7)](/libpmemkv/7.md). For description of pmemkv core API see [**libpmemkv**(3)](/libpmemkv/3.md). For description of configuration API for libpmemkv see [**libpmemkv\_config**(3)](/libpmemkv_config/3.md).

## DESCRIPTION

pmemkv\_json\_config is a helper library that provides two functions:

- **int pmemkv\_config\_from\_json(pmemkv\_config \*config, const char \*jsonconfig);**

  Parses JSON string and puts all items found in JSON into `config`. Allowed types in JSON strings and their corresponding types in pmemkv\_config are: + **number** – int64 or uint64 + **string** – const char \* + **object** – (another JSON string) -\> pointer to pmemkv\_config (can be obtained using pmemkv\_config\_get\_object) + **True**, **False** – int64

- **const char \*pmemkv\_config\_from\_json\_errormsg(void);**

  Returns a human readable string describing the last error.

The \`pmemkv\_config\_from\_json' function depends on RapidJSON library what is the direct cause of the creation of this small library.

The building of this library is enabled by default. It can be disabled by setting the **BUILD\_JSON\_CONFIG** CMake variable to OFF:

-

  ```
  cmake .. -DBUILD_JSON_CONFIG=OFF
  ```

### ERRORS

The *pmemkv\_config\_from\_json()* function returns status. Possible return values are:

- •

  **PMEMKV\_STATUS\_OK** – no error

- •

  **PMEMKV\_STATUS\_UNKNOWN\_ERROR** – unknown error

- •

  **PMEMKV\_STATUS\_CONFIG\_PARSING\_ERROR** – parsing config data failed

## EXAMPLE

An example can be found in [**libpmemkv\_config**(3)](/libpmemkv_config/3.md).

## SEE ALSO

[**libpmemkv**(7)](/libpmemkv/7.md), [**libpmemkv**(3)](/libpmemkv/3.md), [**libpmemkv\_config**(3)](/libpmemkv_config/3.md) and **\<https://pmem.io\>**
