I am trying to establish what is the correct JSON serialization output for a set of classes we have. We use .Net XmlSerializer for XML and JSON.Net for JSON. For a set of classes like:

```
public class User
{
    public AccountType[] Account {get; set;};
}

public class AccountType
{
    public AccountDetailType[] Detail {get; set;}
}

public class AccountDetailType
{
    //properties here
}

```

XML Serializer produces something like:

```
<User>
    <Account>
        <Detail>
        </Detail>
    </Account>
</User>

```

with the root level 'User' node, and `Json.Net JsonConvert.SerializeObject(object);` produces:

```
   {
      "account": 
      [
        {
          "detail": 
          [
            {

            }
          ],

        }
      ], 
    }

```

Note that the parent 'User' type is 'missing' from the JSON output.

We are exchanging the xsd schema for this class hierarchy with a client, but when they generate the Java classes and serialize the object to JSON (do not know using which library), their JSON looks like:

```
    {
    "User": // is this correct?
    {
      "account":
      [
        {
          "detail":
          [
            {
            }
          ],
        }
      ],
    }
}

```

They insist that with the xsd we provided, they can only generate a JSON with the top level/ root element name 'User' in the JSON. I think it is just a problem with their serialization settings. I do not have the xsd sample right now.

Can someone please explain:

1. which JSON output, with or without top level element, is correct or are both valid? XML always writes the root level node, is it 'optional' in JSON?
2. What could be a potential solution here? We want them to generate the JSON without the top level User node (they use Java). They insist their library always produces the top level 'User' node in the JSON output and can't do much about it!