Added logic to handle POST JSON data.