[#nlohmann-basic_json-05-get-02]
= xref:nlohmann.adoc[nlohmann]::xref:nlohmann/basic_json-05.adoc[basic&lowbar;json&lt;&gt;]::get
:relfileprefix: ../../
:mrdocs:

get a (pointer) value (explicit)

== Synopsis

Declared in `&lt;nlohmann&sol;json&period;hpp&gt;`

[source,cpp,subs="verbatim,replacements,macros,-callouts"]
----
template&lt;
    typename ValueTypeCV,
    typename ValueType = detail::uncvref&lowbar;t&lt;ValueTypeCV&gt;&gt;
constexpr
decltype(std&colon;&colon;declval&lt;const basic&lowbar;json&lowbar;t&amp;&gt;()&period;template get&lowbar;impl&lt;ValueType&gt;(detail&colon;&colon;priority&lowbar;tag&lt;4&gt; &lcub;&rcub;))
get() const noexcept(noexcept(std&colon;&colon;declval&lt;const basic&lowbar;json&lowbar;t &amp;&gt;()&period;template get&lowbar;impl&lt;ValueType&gt;(detail&colon;&colon;priority&lowbar;tag&lt;4&gt;&lcub;&rcub;)));
----

== Description

Performs explicit type conversion between the JSON value and a compatible value if required&period;

&hyphen; If the requested type is a pointer to the internally stored JSON value that pointer is returned&period; No copies are made&period;

&hyphen; If the requested type is the current xref:nlohmann/basic_json-05/2constructor-05.adoc[`basic&lowbar;json`], or a different xref:nlohmann/basic_json-05/2constructor-05.adoc[`basic&lowbar;json`] convertible from the current xref:nlohmann/basic_json-05/2constructor-05.adoc[`basic&lowbar;json`]&period;

&hyphen; Otherwise the value is converted by calling the xref:nlohmann/basic_json-05/json_serializer.adoc[`json&lowbar;serializer&lt;ValueType&gt;`] `from&lowbar;json()` method&period;

== Exceptions

[cols="1,4"]
|===
| Name
| Thrown on
| `what`
| xref:nlohmann/basic_json-05/json_serializer.adoc[`json&lowbar;serializer&lt;ValueType&gt;`] `from&lowbar;json()` method throws if conversion is required
|===

== Return Value

copy of the JSON value, converted to

== Template Parameters

[cols="1,4"]
|===
|Name|Description

| *ValueTypeCV*
| the provided value type
| *ValueType*
| the returned value type
| *ValueType*
| if necessary
|===


[.small]#Created with https://www.mrdocs.com[MrDocs]#
