Skip to content
4 changes: 3 additions & 1 deletion docs/mkdocs/docs/api/basic_json/end_pos.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,9 @@ constexpr std::size_t end_pos() const noexcept;
#endif
```

Returns the position after the last character of the JSON string the value was parsed from.
Returns the position immediately following the last character of the JSON string from which the value was parsed,
provided the value originated from a string. If the value was constructed by other means, the function returns
`std::string::npos`.

| JSON type | return value |
|-----------|-----------------------------------|
Expand Down
3 changes: 2 additions & 1 deletion docs/mkdocs/docs/api/basic_json/start_pos.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,8 @@ constexpr std::size_t start_pos() const noexcept;
#endif
```

Returns the position of the first character of the JSON string the value was parsed from.
Returns the position of the first character in the JSON string from which the value was parsed, provided the value
originated from a string. If the value was constructed by other means, the function returns `std::string::npos`.

| JSON type | return value |
|-----------|------------------------------------------------|
Expand Down
9 changes: 4 additions & 5 deletions docs/mkdocs/docs/api/macros/json_diagnostic_positions.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,8 @@ When enabled, two new member functions [`start_pos()`](../basic_json/start_pos.m
[`end_pos()`](../basic_json/end_pos.md) are added to [`basic_json`](../basic_json/index.md) values.
[`start_pos()`](../basic_json/start_pos.md) returns the start position of that JSON value in the original JSON string
the object was parsed from. Likewise, [`end_pos()`](../basic_json/end_pos.md) returns the end position of that JSON
value in the original string the object was parsed from.
value in the original string the object was parsed from. If the value was not parsed, but constructed by other means,
the functions returns `std::string::npos`.

[`start_pos()`](../basic_json/start_pos.md) returns the first character of a given value in the original JSON string,
while [`end_pos()`](../basic_json/end_pos.md) returns the character _following_ the last character. For objects and
Expand All @@ -31,11 +32,9 @@ Given the above, [`end_pos()`](../basic_json/end_pos.md)` - `[`start_pos()`](../
value provides the length of the parsed JSON string for that value, including the opening or closing braces, brackets,
or quotes.

[`start_pos()`](../basic_json/start_pos.md) and [`end_pos()`](../basic_json/end_pos.md) are only set if the JSON value
was parsed using [`parse()`](../basic_json/parse.md). For all other cases,`std::string::npos` will be returned.

Note that enabling this macro increases the size of every JSON value by two `std::size_t` fields and adds slight runtime
overhead.
overhead to parsing, copying JSON value objects, and the generation of error messages for exceptions. It also causes
these values to be reported in those error messages.

## Default definition

Expand Down
Loading