Dear BaseX,

I think there is a very slight bug in the JSON serializer: when an element with type="object" has a <_> child, I think the serializer should report an error (as underscores must be doubled, if not using the name "_", reserved for array items. Instead, the serializer creates a property with the empty string as name. Example:

json:serialize(
<json type="object">
  <BaseX type="object">
    <_>is phantastic</_>
  </BaseX>
</json>
)
=>
{
  "BaseX":{
    "":"is phantastic"
  }
}

Compare with:

json:serialize(
<json type="object">
  <BaseX type="object">
    <__>is phantastic</__>
  </BaseX>
</json>
)
=>
{
  "BaseX":{
    "_":"is phantastic"
  }
}

It may look like pedantry, but this misbehaviour may cause confusion, as it is of course an interesting practise to create JSON by creating the XML format and in the end serializing: if then inspecting the end result, it is not immediately clear that the "":... is caused by the serializer, rather than by own code.

Kind regards,
Hans-Jürgen