-
-
Notifications
You must be signed in to change notification settings - Fork 377
Expand file tree
/
Copy pathJsonUtils.h
More file actions
22 lines (19 loc) · 953 Bytes
/
Copy pathJsonUtils.h
File metadata and controls
22 lines (19 loc) · 953 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
/*---------------------------------------------------------*\
| JsonUtils.h |
| |
| JSON utility functions |
| |
| This file is part of the OpenRGB project |
| SPDX-License-Identifier: GPL-2.0-or-later |
\*---------------------------------------------------------*/
#pragma once
#include <string>
#include <nlohmann/json.hpp>
class JsonUtils
{
public:
static bool JsonGetBool(nlohmann::json& val, std::string key, bool dft = false);
static int JsonGetInt(nlohmann::json& val, std::string key, int dft = 0);
static std::string JsonGetString(nlohmann::json& val, std::string key, std::string dft = "", bool allow_empty = true);
static bool JsonParse(std::string json_string, nlohmann::json& json_ref);
};