print_r used instead of echo to send accurate application/json response