Perform the change of variable $\begin{align}y=\dfrac{\pi}{2}-x\end{align}$
$\begin{align}J&=\int_0^{\frac{\pi}{2}}\ln^2\left(\sin x\right) \,dx\\ &=\int_0^{\frac{\pi}{2}}\ln^2\left(\cos x\right)\,dx\\\end{align}$
Consider the integrals,
$\begin{align}A&=\int_0^{\frac{\pi}{2}}\ln^2\left(\tan x\right)\,dx\\ B&=\int_0^{\frac{\pi}{2}}\ln^2(\sin x\cos x)\,dx\end{align}$
observe that,
$\begin{align}A+B=4J\end{align}$
Perform the change of variable $\begin{align}y=\tan x\end{align}$
$\begin{align}A&=\int_0^\infty \frac{\ln^2 x}{1+x^2}\,dx\end{align}$
Consider the double integral
$\begin{align} K&=\int_0^\infty \int_0^\infty \frac{\ln^2(xy)}{(1+x^2)(1+y^2)}\,dx\,dy\\ &=2\int_0^\infty \int_0^\infty \frac{\ln^2 x}{(1+x^2)(1+y^2)}\,dx\,dy\\ &=\pi A \end{align}$
since,
$\begin{align} \int_0^\infty \frac{\ln x}{1+x^2}\,dx=0\end{align}$
On the other hand, perform the change of variable $u=xy$,
$\begin{align}K&=\int_0^\infty \int_0^\infty \frac{y\ln^2 u}{(u^2+y^2)(1+y^2)}\,du\,dy\\\end{align}$
Perform the change of variable $v=y^2$,
$\begin{align}K&=\frac{1}{2}\int_0^\infty \int_0^\infty \frac{\ln^2 u}{(u^2+v)(1+v)}\,du\,dv\\ &=\frac{1}{2}\int_0^\infty\left[\frac{\ln\left(\frac{v+1}{v+u^2}\right)}{u^2-1}\right]_{v=0}^{\infty}\ln^2 u\,du\\ &=\int_0^\infty\frac{\ln^3 u}{u^2-1}\,du\\ &=\int_0^1\frac{\ln^3 u}{u^2-1}\,du+\int_1^\infty\frac{\ln^3 u}{u^2-1}\,du\\ \end{align}$
In the latter integral perform the change of variable $z=\dfrac{1}{u}$,
$\begin{align}K&=2\int_0^1\frac{\ln^3 u}{u^2-1}\,du\\ &=2\int_0^1\frac{\ln^3 u}{u-1}\,du-\int_0^1\frac{2u\ln^3 u}{u^2-1}\,du \end{align}$
In the latter integral perform the change of variable $z=u^2$,
$\begin{align}K&=\left(2-\frac{1}{8}\right)\int_0^1\frac{\ln^3 u}{u-1}\,du\\ &=-\frac{15}{8}\int_0^1\left( \sum_{n=0}^\infty u^{n}\right)\ln^3 u\,du\\ &=-\frac{15}{8}\sum_{n=0}^\infty\int_0^1 u^{n}\ln^3 u\,du\\ &=\frac{45}{4} \sum_{n=0}^\infty\frac{1}{(n+1)^4}\\ &=\frac{45}{4}\zeta(4)\\ \end{align}$
therefore,
$\begin{align}A&=\frac{K}{\pi}\\ &=\frac{45}{4\pi}\zeta(4)\end{align}$
$\begin{align} B&=\int_0^{\frac{\pi}{2}}\ln^2\left(\frac{\sin(2x)}{2}\right)\,dx \end{align}$
Perform the change of variable $y=2x$,
$\begin{align} B&=\frac{1}{2}\int_0^{\pi}\ln^2\left(\frac{\sin x}{2}\right)\,dx\\ &=\frac{1}{2}\int_0^{\frac{\pi}{2}}\ln^2\left(\frac{\sin x}{2}\right)\,dx+\frac{1}{2}\int_{\frac{\pi}{2}}^{\pi}\ln^2\left(\frac{\sin x}{2}\right)\,dx\\ \end{align}$
In the latter integral perform the change of variable $y=\pi-x$,
$\begin{align} B&=\int_0^{\frac{\pi}{2}}\ln^2\left(\frac{\sin x}{2}\right)\,dx\\ &=\int_0^{\frac{\pi}{2}}\ln^2\left(\sin x\right)\,dx-2\ln 2\int_0^{\frac{\pi}{2}}\ln(\sin x)\,dx+\frac{\pi}{2}\ln^2 2\\ &=J+\frac{3\pi}{2}\ln^2 2 \end{align}$
Therefore,
$\begin{align}\frac{45}{4}\zeta(4)+J+\frac{3\pi}{2}\ln^2 2=4J \end{align}$
Thus,
$\begin{align}J&=\frac{15}{4\pi}\zeta(4)+\frac{1}{2}\pi\ln^2 2 \end{align}$
If you know that,
$\begin{align}\zeta(4)=\frac{\pi^4}{90}\end{align}$
therefore,
$\begin{align}\boxed{J=\frac{\pi^3}{24}+\frac{1}{2}\pi\ln^2 2} \end{align}$