[#BloombergLP-bdljsn-Json-visit-02]
= xref:BloombergLP.adoc[BloombergLP]::xref:BloombergLP/bdljsn.adoc[bdljsn]::xref:BloombergLP/bdljsn/Json.adoc[Json]::visit
:relfileprefix: ../../../
:mrdocs:

Invoke `visitor` on the value held by this object&period;

== Synopsis

Declared in `&lt;bdljsn&lowbar;json&period;h&gt;`

[source,cpp,subs="verbatim,replacements,macros,-callouts"]
----
template&lt;
    class RETURN&lowbar;TYPE,
    class VISITOR&gt;
RETURN&lowbar;TYPE
visit(VISITOR&& visitor);
----

== Description

Return the result (having `RETURN&lowbar;TYPE`) of invoking the specified `visitor` (callable) object on this `Json` object&period; `visitor` must be callable as if it provides the following overloads of `operator()`&colon; &grave; RETURN&lowbar;TYPE operator()(JsonObject &ast;object )&semi; RETURN&lowbar;TYPE operator()(JsonArray &ast;array )&semi; RETURN&lowbar;TYPE operator()(bsl&colon;&colon;string &ast;string )&semi; RETURN&lowbar;TYPE operator()(JsonNumber &ast;number )&semi; RETURN&lowbar;TYPE operator()(bool &ast;boolean)&semi; RETURN&lowbar;TYPE operator()(JsonNull &ast;null )&semi; &grave; The overload corresponding to the current `type()` of this `Json` object is invoked&period; For C&plus;&plus;03 `visitor` must be `const` qualified&period; The behavior is undefined unless all of these six overloads are defined&period; The behavior is undefined if the `string` overload leaves this `Json` object with a string that is not valid UTF&hyphen;8&period; Note that overloads that are not applicable in a given application need not do anything other than return&period; Also note that if `visitor` is `const` qualified then each of its `operator()` overloads must also be `const` qualified&period;

== Return Value

result (having `RETURN&lowbar;TYPE`) of invoking the specified `visitor` (callable) object on this `Json` object

== Parameters

[cols="1,4"]
|===
| Name| Description
| *visitor*
| callable invoked with the held value
|===


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