$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 
27 #include <string> // for string
28 
29 #include <nlohmann/json.hpp> // for Json
30 
31 #include <fable/fable_fwd.hpp>
32 
33 namespace fable {
34 
44 
53 
62 using Json = nlohmann::json;
63 
70 using JsonPointer = nlohmann::json_pointer<std::string>;
71 
78 using JsonType = nlohmann::json::value_t;
79 
95 std::string to_string(JsonType);
96 
104 template <typename InputType>
105 Json parse_json(InputType&& input) {
106  return Json::parse(std::forward<InputType>(input), nullptr, NLOHMANN_JSON_USE_EXCEPTIONS,
108 }
109 
110 } // namespace fable
nlohmann::json Json
Definition: fable_fwd.hpp:35
nlohmann::json_pointer< std::string > JsonPointer
Definition: fable_fwd.hpp:36
bool NLOHMANN_JSON_ALLOW_COMMENTS
Definition: json.cpp:38
bool NLOHMANN_JSON_USE_EXCEPTIONS
Definition: json.cpp:37
nlohmann::json::value_t JsonType
Definition: json.hpp:78
Json parse_json(InputType &&input)
Definition: json.hpp:105