FreeBSD has many jail aware utilities but they are inconsistent in
taking JID as parameter.
For example "sockstat" takes -j JID "Show only sockets belonging to the
specified jail ID" and it means numeric ID only.
On the other hand "ps" takes -J JID "This may be either the jid or name
of the jail. Use -J 0 to display only host processes."
The same apply for "top", it understands jid as a number or name of the
jail too.
Then again "cpuset" takes only numerical ID of the jail...
This should be consistent across all FreeBSD base utilities so all of
them can use numerical ID and name.
I took a quick look in to sources and almost each util has very different code to work with JID / jail name.
I am not C developer so I cannot provide any patches. I hope somebody else will have free time to fix these utilities.
Note I found this commit to fix jid / jail name problem for pgrep/pkill but again, it is very different code to what I found for procstat or sockstat
https://svnweb.freebsd.org/base?view=revision&revision=287012

I found four programs that let you specify a jail by JID only:
cpuset(1)
ipfw(8)
sockstat(1)
ugidfw(8)
Eight programs (11 if you count the jail programs themselves) that allow jails to be specified by name or ID:
ifconfig(8)
ifconfig(8)
pkill(1)
ps(1)
service(8)
sysrc(8)
xtop(1)
zfs(8)
And one that only allows jail by name:
rctl(8)
Of the four that only take a JID, a fix is easy for cpuset, ipfw, and sockstat. ugidfw(8) actually parses the JID in libugidfw(3), and I'm hesitant to introduce a library dependency within another library; I may end up basically re-coding jail_getid(3) there.
A "fix" for rctl(8) to take JIDs is out of scope: the name parsing for that one is actually done in the kernel.