Adapted to getting json instead of text