1
0
mirror of https://github.com/nlohmann/json.git synced 2025-07-28 12:02:00 +03:00

Consolidate documentation (#3071)

* 🔥 consolidate documentation
* ♻️ overwork std specializations
* 🚚 move images files to mkdocs
* ♻️ fix URLs
* 🔧 tweak MkDocs configuration
* 🔧 add namespaces
* 📝 document deprecations
* 📝 document documentation generation
* 🚸 improve search
* 🚸 add examples
* 🚧 start adding documentation for macros
* 📝 add note for https://github.com/nlohmann/json/issues/874#issuecomment-1001699139
* 📝 overwork example handling
* 📝 fix Markdown tables
This commit is contained in:
Niels Lohmann
2021-12-29 13:41:01 +01:00
committed by GitHub
parent 6d3115924c
commit 29cd970b94
392 changed files with 4827 additions and 12560 deletions

View File

@ -1,4 +1,4 @@
# basic_json::value
# <small>nlohmann::basic_json::</small>value
```cpp
// (1)
@ -36,8 +36,11 @@ ValueType value(const json_pointer& ptr,
}
```
Unlike [`operator[]`](operator[].md), this function does not implicitly add an element to the position defined by
`key`/`ptr` key. This function is furthermore also applicable to const objects.
!!! note
- Unlike [`at`](at.md), this function does not throw if the given `key`/`ptr` was not found.
- Unlike [`operator[]`](operator[].md), this function does not implicitly add an element to the position defined by
`key`/`ptr` key. This function is furthermore also applicable to const objects.
## Template parameters
@ -85,9 +88,9 @@ changes to any JSON value.
1. Logarithmic in the size of the container.
2. Logarithmic in the size of the container.
## Example
## Examples
??? example
??? example "Example (1): access specified object element with default value"
The example below shows how object elements can be queried with a default value.
@ -101,7 +104,7 @@ changes to any JSON value.
--8<-- "examples/basic_json__value.output"
```
??? example
??? example "Example (2): access specified object element via JSON Pointer with default value"
The example below shows how object elements can be queried with a default value.
@ -115,6 +118,11 @@ changes to any JSON value.
--8<-- "examples/basic_json__value_ptr.output"
```
## See also
- see [`at`](at.md) for access by reference with range checking
- see [`operator[]`](operator%5B%5D.md) for unchecked access by reference
## Version history
1. Added in version 1.0.0.