FInally fixed the json handling