  We study the so-called John-Nirenberg space that is a generalization of
functions of bounded mean oscillation in the setting of metric measure spaces
with a doubling measure. Our main results are local and global John-Nirenberg
inequalities, which give weak type estimates for the oscillation of a function.
We consider medians instead of integral averages throughout, and thus functions
are not a priori assumed to be locally integrable. Our arguments are based on a
Calder\'{o}n-Zygmund decomposition and a good-$\lambda$ inequality for medians.
A John-Nirenberg inequality up to the boundary is proven by using chaining
arguments. As a consequence, the integral-type and the median-type
John-Nirenberg spaces coincide under a Boman-type chaining assumption.
