mirror of
https://github.com/nlohmann/json.git
synced 2026-10-03 05:00:30 +00:00
Document element access, lookup, and iteration of json_view
- API pages for operator[], at, front, back, find, contains, count, begin, end, cbegin, cend, items, and type_name of basic_json_view, linked both ways with the basic_json pages - the feature page and size() describe document order and duplicate keys - the examples show when the view helps: reading a few fields of a large text, probing optional members, and members in source order Signed-off-by: Niels Lohmann <mail@nlohmann.me>
This commit is contained in:
@@ -219,6 +219,7 @@ Strong exception safety: if an exception occurs, the original value stays intact
|
||||
- documentation on [checked access](../../features/element_access/checked_access.md)
|
||||
- [`operator[]`](operator%5B%5D.md) for unchecked access by reference
|
||||
- [`value`](value.md) for access with default value
|
||||
- [basic_json_view::at](../basic_json_view/at.md) - the same access on a zero-copy view
|
||||
|
||||
## Version history
|
||||
|
||||
|
||||
@@ -58,6 +58,7 @@ Constant.
|
||||
## See also
|
||||
|
||||
- [front](front.md) to access the first element
|
||||
- [basic_json_view::back](../basic_json_view/back.md) - the same access on a zero-copy view
|
||||
|
||||
## Version history
|
||||
|
||||
|
||||
@@ -37,6 +37,12 @@ Constant.
|
||||
--8<-- "examples/begin.output"
|
||||
```
|
||||
|
||||
## See also
|
||||
|
||||
- [end](end.md) - returns an iterator to one past the last element
|
||||
- [basic_json_view::begin](../basic_json_view/begin.md) - the same iteration on a zero-copy view (in document order,
|
||||
not sorted by key)
|
||||
|
||||
## Version history
|
||||
|
||||
- Added in version 1.0.0.
|
||||
|
||||
@@ -36,6 +36,11 @@ Constant.
|
||||
--8<-- "examples/cbegin.output"
|
||||
```
|
||||
|
||||
## See also
|
||||
|
||||
- [cend](cend.md) - returns a const iterator to one past the last element
|
||||
- [basic_json_view::cbegin](../basic_json_view/cbegin.md) - the same iteration on a zero-copy view
|
||||
|
||||
## Version history
|
||||
|
||||
- Added in version 1.0.0.
|
||||
|
||||
@@ -36,6 +36,11 @@ Constant.
|
||||
--8<-- "examples/cend.output"
|
||||
```
|
||||
|
||||
## See also
|
||||
|
||||
- [cbegin](cbegin.md) - returns a const iterator to the first element
|
||||
- [basic_json_view::cend](../basic_json_view/cend.md) - the same iteration on a zero-copy view
|
||||
|
||||
## Version history
|
||||
|
||||
- Added in version 1.0.0.
|
||||
|
||||
@@ -115,6 +115,7 @@ Logarithmic in the size of the JSON object.
|
||||
|
||||
- [find](find.md) find a value in an object
|
||||
- [count](count.md) returns the number of occurrences of a key
|
||||
- [basic_json_view::contains](../basic_json_view/contains.md) - the same check on a zero-copy view
|
||||
|
||||
## Version history
|
||||
|
||||
|
||||
@@ -80,6 +80,7 @@ Logarithmic in the size of the JSON object.
|
||||
|
||||
- [find](find.md) find a value in an object
|
||||
- [contains](contains.md) checks whether a key exists
|
||||
- [basic_json_view::count](../basic_json_view/count.md) - the same check on a zero-copy view
|
||||
|
||||
## Version history
|
||||
|
||||
|
||||
@@ -37,6 +37,11 @@ Constant.
|
||||
--8<-- "examples/end.output"
|
||||
```
|
||||
|
||||
## See also
|
||||
|
||||
- [begin](begin.md) - returns an iterator to the first element
|
||||
- [basic_json_view::end](../basic_json_view/end.md) - the same iteration on a zero-copy view
|
||||
|
||||
## Version history
|
||||
|
||||
- Added in version 1.0.0.
|
||||
|
||||
@@ -84,6 +84,7 @@ Logarithmic in the size of the JSON object.
|
||||
|
||||
- [count](count.md) returns the number of occurrences of a key
|
||||
- [contains](contains.md) checks whether a key exists
|
||||
- [basic_json_view::find](../basic_json_view/find.md) - the same lookup on a zero-copy view
|
||||
|
||||
## Version history
|
||||
|
||||
|
||||
@@ -51,6 +51,7 @@ Constant.
|
||||
## See also
|
||||
|
||||
- [back](back.md) to access the last element
|
||||
- [basic_json_view::front](../basic_json_view/front.md) - the same access on a zero-copy view
|
||||
|
||||
## Version history
|
||||
|
||||
|
||||
@@ -99,6 +99,8 @@ When iterating over an array, `key()` will return the index of the element as st
|
||||
|
||||
- [begin](begin.md) returns an iterator to the first element
|
||||
- [end](end.md) returns an iterator to one past the last element
|
||||
- [basic_json_view::items](../basic_json_view/items.md) - the same range on a zero-copy view (`#!cpp const auto`,
|
||||
not `#!cpp const auto&`: items are produced on the fly)
|
||||
|
||||
## Version history
|
||||
|
||||
|
||||
@@ -257,6 +257,8 @@ Strong exception safety: if an exception occurs, the original value stays intact
|
||||
- documentation on [runtime assertions](../../features/assertions.md)
|
||||
- see [`at`](at.md) for access by reference with range checking
|
||||
- see [`value`](value.md) for access with default value
|
||||
- [basic_json_view::operator[]](../basic_json_view/operator%5B%5D.md) - the same access on a zero-copy view (always
|
||||
returns a discarded view instead of assuming undefined behavior)
|
||||
|
||||
## Version history
|
||||
|
||||
|
||||
@@ -52,6 +52,11 @@ Constant.
|
||||
--8<-- "examples/type_name.output"
|
||||
```
|
||||
|
||||
## See also
|
||||
|
||||
- [type](type.md) - return the type of the JSON value
|
||||
- [basic_json_view::type_name](../basic_json_view/type_name.md) - the same function on a zero-copy view
|
||||
|
||||
## Version history
|
||||
|
||||
- Added in version 1.0.0.
|
||||
|
||||
Reference in New Issue
Block a user