A11 (C++ runtime)
Native C++ implementation of the A11 streaming action runtime
Loading...
Searching...
No Matches
json.h
Go to the documentation of this file.
1/*
2 * Copyright 2026 The A11 Authors
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
17#ifndef A11_DATA_JSON_H_
18#define A11_DATA_JSON_H_
19
20#include <string>
21#include <string_view>
22
23#include <absl/status/statusor.h>
24#include <nlohmann/json_fwd.hpp>
25
26#include "a11/data/types.h"
27
28namespace a11::data {
29
30// JSON encoding used by A11's HTTP/SSE transports.
31absl::StatusOr<nlohmann::json> WireMessageToJsonValue(
32 const WireMessage& message);
33absl::StatusOr<std::string> WireMessageToJson(const WireMessage& message);
34absl::StatusOr<WireMessage> WireMessageFromJsonValue(
35 const nlohmann::json& value);
36absl::StatusOr<WireMessage> WireMessageFromJson(std::string_view encoded);
37
38} // namespace a11::data
39
40#endif // A11_DATA_JSON_H_
std::string value
Definition discover.cc:114
Definition json.cc:35
absl::StatusOr< WireMessage > WireMessageFromJsonValue(const Json &value)
Definition json.cc:442
absl::StatusOr< WireMessage > WireMessageFromJson(std::string_view encoded)
Definition json.cc:478
absl::StatusOr< std::string > WireMessageToJson(const WireMessage &message)
Definition json.cc:437
absl::StatusOr< Json > WireMessageToJsonValue(const WireMessage &message)
Definition json.cc:414
A11's core wire value types: chunks, node fragments and messages.