What you are creating is not actually a JSON object. It has nothing to do with JSON, though I can see why you thing it does based on the syntax. It is actually an anonymous type.
You can nest these types inside each other, like so (translating your example):
var Obj = new
{
username = new
{
username = "Test",
password = "TEST"
},
key = new
{
Key1 = "OK"
}
};
1
solved How to create 2 dimensional json object in chsarp