Symbian platform (C++)
SDK native APIs, runtime and tooling
Loading...
Searching...
No Matches
json_codec.h File Reference

A11's JSON/MessagePack codec, adapted to compile without exceptions. More...

#include <string>
#include <string_view>
#include <absl/status/statusor.h>
#include <nlohmann/json.hpp>
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Namespaces

namespace  symbian
 

Functions

absl::StatusOr< Json > symbian::ParseJson (std::string_view encoded, std::string_view what)
 Parses JSON text, or explains why it is not JSON.
 
bool symbian::IsValidUtf8 (std::string_view text)
 Whether text is valid UTF-8.
 
const nlohmann::json * symbian::FindUnencodableString (const nlohmann::json &value)
 The first string inside value that is not valid UTF-8, or nullptr.
 
absl::StatusOr< std::string > symbian::DumpJson (const nlohmann::json &value, std::string_view what)
 Serializes value, rejecting strings that are not valid UTF-8.
 
std::string symbian::DumpJsonLossy (const nlohmann::json &value)
 Serializes value, replacing anything that is not valid UTF-8.
 
absl::StatusOr< std::string > symbian::PackMsgpack (const nlohmann::json &value, std::string_view what)
 Encodes value as MessagePack, or says why it cannot be.
 
absl::StatusOr< Json > symbian::UnpackMsgpack (std::string_view encoded, std::string_view what)
 Decodes MessagePack bytes, or explains why they are not.
 

Detailed Description

A11's JSON/MessagePack codec, adapted to compile without exceptions.

Parsing uses allow_exceptions=false. Serialization preflights string values and object keys. Invalid input becomes an Abseil status; diagnostic reparsing with exceptions is omitted. See .dev/a11-status.md for the recorded changes.