# Advanced

When we have complex class structures and relations, we can simply represent them as some formats such as JSON.

Here is a simple example of the situation:

```json
[
    {
        "id": "myCat",
        "target": "com.example.Cat"
        "args":[":s/Pamuk",":i/5"]
    },
    {
        "id": "myDog",
        "target": "com.example.Dog"
        "fields": [
            {"name":"name","value":":s/Karabaş"},
            {"name":"age", "value":":i/4"}
        ]
    },
    {
        "id": "catndog",
        "target":"com.example.CatNDog"
        "fields":[
            {"name":"cat", "value":"@myCat"},
            {"name":"dog", "value":"@myDog"},
        ]
    }
]
```

This JSON file represents our class structures and relations with each other. DepIn can read this file and generates instances of the classes that described there.

```java
DepIn depIn = DepIn.JsonContext("src/test/resources/classmap.json");


// Creates Cat object, Dog object, CatNDog object
// and injects Cat and Dog object into CatNDog object
CatNDog catndog = depIn.getInstance("@catndog");

// Creates a cat instance with defined parameters in json file
Cat tekir = depIn.getInstance("@mycat");
```


---

# 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://rasnesakam.gitbook.io/depin/advanced.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.
