1# basic_json::get_to 2 3```cpp 4template<typename ValueType> 5ValueType& get_to(ValueType& v) const noexcept( 6 noexcept(JSONSerializer<ValueType>::from_json( 7 std::declval<const basic_json_t&>(), v))) 8``` 9 10Explicit type conversion between the JSON value and a compatible value. The value is filled into the input parameter by 11calling the `json_serializer<ValueType>` `from_json()` method. 12 13The function is equivalent to executing 14```cpp 15ValueType v; 16JSONSerializer<ValueType>::from_json(*this, v); 17``` 18 19This overloads is chosen if: 20 21- `ValueType` is not `basic_json`, 22- `json_serializer<ValueType>` has a `from_json()` method of the form `void from_json(const basic_json&, ValueType&)` 23 24## Template parameters 25 26`ValueType` 27: the value type to return 28 29## Return value 30 31the input parameter, allowing chaining calls 32 33## Exceptions 34 35Depends on what `json_serializer<ValueType>` `from_json()` method throws 36 37## Example 38 39??? example 40 41 The example below shows several conversions from JSON values to other types. There a few things to note: (1) 42 Floating-point numbers can be converted to integers, (2) A JSON array can be converted to a standard 43 `#!cpp std::vector<short>`, (3) A JSON object can be converted to C++ associative containers such as 44 `#cpp std::unordered_map<std::string, json>`. 45 46 ```cpp 47 --8<-- "examples/get_to.cpp" 48 ``` 49 50 Output: 51 52 ```json 53 --8<-- "examples/get_to.output" 54 ``` 55 56## Version history 57 58- Since version 3.3.0. 59