Help making tutorial apps

I’m looking into using ajax and the xhttp functions there but I’m not sure exactly how to send and receive the json information that is supposedly sent back to the user over http. ajax seems to only have a function to receive text or xml so I’m not quite sure how to handle that or corretly convert it into a json file.