Added logic for JSON