Fix for JSON encoding of objects spilling out to non-std objects