let json return custom failure codes

the default function does exactly what was happening before.