# Get Object

Get a whole `Object` using a [**`Query`**](/code_examples/queries.md):

{% tabs %}
{% tab title="Java" %}

```java
import com.parse.ParseObject;
import com.parse.ParseQuery;
import com.parse.GetCallback;
import com.parse.ParseException;

public void getObject()
{
  ParseQuery<ParseObject> query = ParseQuery.getQuery("ClassName");
  query.getInBackground("objectId", new GetCallback<ParseObject>() 
  {
    public void done(ParseObject object, ParseException e) 
    {
      if (e == null) 
      {
        // your object will be returned here
      } 
      else 
      {
        // something went wrong, check the exception for more infos
      } 
    }
  });
}
```

{% endtab %}

{% tab title="Swift" %}

```swift
import Parse
​
class testVC: UIViewController
{
    override func viewDidLoad()
    {
        super.viewDidLoad()
        self.getObjet(id:"AB1234")
    }
​
​
    func getObjet(id:String)
    {
        let query = PFQuery.init(className: "ClassName")
        query.getObjectInBackground(withId: id)  
    }
}
```

{% endtab %}
{% endtabs %}

Get the values out of the `Object`:

{% tabs %}
{% tab title="Java" %}

```java
import com.parse.ParseObject;

public void getSomeValues(ParseObject object)
{
    int age = object.getInt("age");
    String userName = object.getString("userName");
    boolean isFunny = object.getBoolean("isFunny");
    ParseObject = object.getParseObject("customObject");
}
```

{% endtab %}

{% tab title="Swift" %}

{% endtab %}
{% endtabs %}

Special values that have their own accessors:

{% tabs %}
{% tab title="Java" %}

```java
import com.parse.ParseObject;

public void getSpecialValues(ParseObject object)
{
    String objectId = object.getObjectId();
    Date updatedAt = object.getUpdatedAt();
    Date createdAt = object.getCreatedAt();
    ParseACL acl = object.getACL();
}
```

{% endtab %}

{% tab title="Swift" %}

```
```

{% endtab %}
{% endtabs %}

Refresh an object that you already have in memory with the latest data:

{% tabs %}
{% tab title="Java" %}

```java
import com.parse.ParseObject;
import com.parse.GetCallback;
import com.parse.ParseException;

public void refreshObject(ParseObject object)
{
    object.fetchInBackground(new GetCallback<ParseObject>() 
    {
      public void done(ParseObject object, ParseException e) 
      {
        if (e == null) 
        {
          // Success!
        } 
        else 
        {
          // Failure!
        }
      }
    });
}
```

{% endtab %}

{% tab title="Swift" %}

{% endtab %}
{% endtabs %}


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://docs.symbyoz.io/code_examples/get-object.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
