• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1# <small>nlohmann::basic_json::</small>get_binary
2
3```cpp
4binary_t& get_binary();
5
6const binary_t& get_binary() const;
7```
8
9Returns a reference to the stored binary value.
10
11## Return value
12
13Reference to binary value.
14
15## Exception safety
16
17Strong exception safety: if an exception occurs, the original value stays intact.
18
19## Exceptions
20
21Throws [`type_error.302`](../../home/exceptions.md#jsonexceptiontype_error302) if the value is not binary
22
23## Complexity
24
25Constant.
26
27## Examples
28
29??? example
30
31    The following code shows how to query a binary value.
32
33    ```cpp
34    --8<-- "examples/get_binary.cpp"
35    ```
36
37    Output:
38
39    ```json
40    --8<-- "examples/get_binary.output"
41    ```
42
43## Version history
44
45- Added in version 3.8.0.
46