adds generic json funtion to have the same behavior as before