---
title: toObject()
framework: javascriptcore
role: symbol
role_heading: Instance Method
path: javascriptcore/jsvalue/toobject()
---

# toObject()

Converts the JavaScript value to a native object.

## Declaration

```swift
func toObject() -> Any!
```

## Return Value

Return Value An Objective-C or Swift object representing the JavaScript value.

## Discussion

Discussion The type of the resulting object depends on the contents of the JavaScript value. For conversion rules, see Convert Between JavaScript and Native Types.

## See Also

### Reading and Converting JavaScript Values

- [toObjectOf(_:)](javascriptcore/jsvalue/toobjectof(_:).md)
- [toBool()](javascriptcore/jsvalue/tobool().md)
- [toDouble()](javascriptcore/jsvalue/todouble().md)
- [toInt32()](javascriptcore/jsvalue/toint32().md)
- [toUInt32()](javascriptcore/jsvalue/touint32().md)
- [toNumber()](javascriptcore/jsvalue/tonumber().md)
- [toString()](javascriptcore/jsvalue/tostring().md)
- [toDate()](javascriptcore/jsvalue/todate().md)
- [toArray()](javascriptcore/jsvalue/toarray().md)
- [toDictionary()](javascriptcore/jsvalue/todictionary().md)
- [toPoint()](javascriptcore/jsvalue/topoint().md)
- [toRange()](javascriptcore/jsvalue/torange().md)
- [toRect()](javascriptcore/jsvalue/torect().md)
- [toSize()](javascriptcore/jsvalue/tosize().md)
