JSON API: do not use anonymous function

It's not compatible with PHP 5.2