MongoDB C++ Driver 4.1.0
All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
json.hpp
Go to the documentation of this file.
1// Copyright 2009-present MongoDB, Inc.
2//
3// Licensed under the Apache License, Version 2.0 (the "License");
4// you may not use this file except in compliance with the License.
5// You may obtain a copy of the License at
6//
7// http://www.apache.org/licenses/LICENSE-2.0
8//
9// Unless required by applicable law or agreed to in writing, software
10// distributed under the License is distributed on an "AS IS" BASIS,
11// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12// See the License for the specific language governing permissions and
13// limitations under the License.
14
15#pragma once
16
17#include <string>
18
19#include <bsoncxx/json-fwd.hpp>
20
25
27
28namespace bsoncxx {
29namespace v_noabi {
30
33enum class ExtendedJsonMode : std::uint8_t {
37};
38
52
53BSONCXX_ABI_EXPORT_CDECL(std::string)
55
56BSONCXX_ABI_EXPORT_CDECL(std::string)
58
61
72
85BSONCXX_ABI_EXPORT_CDECL(document::value) operator"" _bson(char const* json, size_t len);
86
87} // namespace v_noabi
88} // namespace bsoncxx
89
90namespace bsoncxx {
91
94
95using ::bsoncxx::v_noabi::operator"" _bson;
96
97} // namespace bsoncxx
98
100
Provides bsoncxx::v_noabi::array::view.
#define BSONCXX_ABI_EXPORT_CDECL(...)
Equivalent to BSONCXX_ABI_EXPORT with BSONCXX_ABI_CDECL.
Definition export.hpp:52
The bsoncxx v_noabi macro guard postlude header.
The bsoncxx v_noabi macro guard prelude header.
Provides bsoncxx::v_noabi::document::value.
Provides bsoncxx::v_noabi::document::view.
Declares bsoncxx::v_noabi::ExtendedJsonMode.
Declares entities representing a BSON array.
Declares entities representing a BSON document.
Declares C++17 standard library polyfills.
Declares entities whose ABI stability is NOT guaranteed.
std::string to_json(document::view view, ExtendedJsonMode mode=ExtendedJsonMode::k_legacy)
Converts a BSON document to a JSON string, in extended format.
ExtendedJsonMode
An enumeration of the types of Extended JSON that the to_json function accepts.
Definition json.hpp:33
@ k_relaxed
to produce Relaxed Extended JSON
Definition json.hpp:36
@ k_legacy
to produce Legacy Extended JSON
Definition json.hpp:34
@ k_canonical
to produce Canonical Extended JSON
Definition json.hpp:35
document::value from_json(stdx::string_view json)
Constructs a new document::value from the provided JSON text.
The top-level namespace within which all bsoncxx library entities are declared.
Provides std::optional-related polyfills for library API usage.