$darkmode
json.hpp
Go to the documentation of this file.
1 /*
2  * Copyright 2020 Robert Bosch GmbH
3  *
4  * Licensed under the Apache License, Version 2.0 (the "License");
5  * you may not use this file except in compliance with the License.
6  * You may obtain a copy of the License at
7  *
8  * http://www.apache.org/licenses/LICENSE-2.0
9  *
10  * Unless required by applicable law or agreed to in writing, software
11  * distributed under the License is distributed on an "AS IS" BASIS,
12  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13  * See the License for the specific language governing permissions and
14  * limitations under the License.
15  *
16  * SPDX-License-Identifier: Apache-2.0
17  */
25 #pragma once
26 #ifndef FABLE_JSON_HPP_
27 #define FABLE_JSON_HPP_
28 
29 #include <string> // for string
30 
31 #include <nlohmann/json.hpp> // for Json
32 
33 namespace fable {
34 
44 
53 
62 using Json = nlohmann::json;
63 
70 using JsonPointer = Json::json_pointer;
71 
78 using JsonType = Json::value_t;
79 
95 std::string to_string(JsonType);
96 
104 template <typename InputType>
105 inline Json parse_json(InputType&& input) {
106  return Json::parse(std::forward<InputType>(input), nullptr, NLOHMANN_JSON_USE_EXCEPTIONS,
107  NLOHMANN_JSON_ALLOW_COMMENTS);
108 }
109 
110 } // namespace fable
111 
112 #endif // FABLE_JSON_HPP_
nlohmann::json Json
Definition: json.hpp:62
Json::value_t JsonType
Definition: json.hpp:78
Definition: conf.hpp:70
bool NLOHMANN_JSON_USE_EXCEPTIONS
Definition: json.cpp:37
Json::json_pointer JsonPointer
Definition: json.hpp:70
bool NLOHMANN_JSON_ALLOW_COMMENTS
Definition: json.cpp:38
Json parse_json(InputType &&input)
Definition: json.hpp:105