Fix undefined $json usage

Authored by Reedy.