Question: I have to design a class based on a json template that i received. I'm stuck at this part of the json:

```
events: {
    "door": [
        5,
        {
            valueone: 27,
            valuetwo: "something"
        }
    ],
    "window": [
        2,
        {
            valueone: 13,
            valuetwo: "something"
        }
    ]
}

```

The best i can come up with is this property in the root object:

```
public Dictionary<string, EventData> Events { get; set; }

```

Where Events is defined like this:

```
public class EventData
{
    public int valueone { get; set; }
    public string valuetwo { get; set; }
}

```

This gives me for example the following output:

```
Events: {
    door: {
        valueone: 27,
        valuetwo: "something"
    }
}

```

But i have no idea how to design the class to get the numbers in the json example (5 and 2) in the output. I have tried to google for this for a long time today but i'm not quite sure what to search for.

Answer: 
```
Class.getMethod(methodName).invoke(....);

```

See the API for more info: <http://docs.oracle.com/javase/7/docs/api/java/lang/Class.html>
```
     //load desired Class at runtime
  Class classObj = Class.forName("xyz.abc.YourClassName");
  Object obj = classObj .newInstance();

 //invoke specific method at runtime
     for( String methodName : result.keySet() ){
       Method method = cls.getDeclaredMethod(methodName , noparams);
       method.invoke(obj, null);
      }

```