<commit_before>package com.google.code.quandary.quiz;


import org.apache.http.HttpEntity;
import org.apache.http.HttpResponse;
import org.apache.http.client.HttpClient;
import org.apache.http.client.methods.HttpGet;
import org.apache.http.impl.client.DefaultHttpClient;
import org.json.JSONArray;
import org.json.JSONException;
import org.json.JSONObject;

import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;

public class JsonRemoteReader {


    public static Quiz convertToQuize(String jasonString)      {
          Quiz quiz = new Quiz();
        try {
            JSONObject jsonQuize = new JSONObject(jasonString);
            // Get the query value'
            String video_id = jsonQuize.getString("video_id");
            quiz.setVideoId(video_id);
            // Make array of the questions
            JSONArray questions = jsonQuize.getJSONArray("questions");
            for (int i = 0; i < questions.length(); i++) {
                Question question=new Question();
                quiz.getQuestions().add(question);
                JSONObject jsonQuestion = questions.getJSONObject(i);
                Long timeToPause=jsonQuestion.getLong("time");
                 String questionString=  jsonQuestion.getString("question")   ;
                question.setTimeToPause(timeToPause);
                question.setQuestionDescription(questionString);
                JSONArray answers =jsonQuestion.getJSONArray("answers");
                for(int j=0; j<answers.length(); j++){
                    JSONObject jsonAnswer = answers.getJSONObject(j);
                    String text=  jsonAnswer.getString("text");
                    question.getAnswers().add(text);
                    boolean correct = jsonAnswer.has("correct") && jsonAnswer.getBoolean("correct");
                    if(correct)    {
                        question.setCorrectAnswer(i);
                    }
                }
            }
<commit_msg>Set the correct answer correctly :)<commit_after>package com.google.code.quandary.quiz;


import org.apache.http.HttpEntity;
import org.apache.http.HttpResponse;
import org.apache.http.client.HttpClient;
import org.apache.http.client.methods.HttpGet;
import org.apache.http.impl.client.DefaultHttpClient;
import org.json.JSONArray;
import org.json.JSONException;
import org.json.JSONObject;

import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;

public class JsonRemoteReader {


    public static Quiz convertToQuize(String jasonString)      {
          Quiz quiz = new Quiz();
        try {
            JSONObject jsonQuize = new JSONObject(jasonString);
            // Get the query value'
            String video_id = jsonQuize.getString("video_id");
            quiz.setVideoId(video_id);
            // Make array of the questions
            JSONArray questions = jsonQuize.getJSONArray("questions");
            for (int i = 0; i < questions.length(); i++) {
                Question question=new Question();
                quiz.getQuestions().add(question);
                JSONObject jsonQuestion = questions.getJSONObject(i);
                Long timeToPause=jsonQuestion.getLong("time");
                 String questionString=  jsonQuestion.getString("question")   ;
                question.setTimeToPause(timeToPause);
                question.setQuestionDescription(questionString);
                JSONArray answers =jsonQuestion.getJSONArray("answers");
                for(int j=0; j<answers.length(); j++){
                    JSONObject jsonAnswer = answers.getJSONObject(j);
                    String text=  jsonAnswer.getString("text");
                    question.getAnswers().add(text);
                    boolean correct = jsonAnswer.optBoolean("correct");
                    if(correct)    {
                        question.setCorrectAnswer(j);
                    }
                }
            }

{'fraction_non_alphanumeric': 0.0995260663507109, 'fraction_numerical': 0.0009977550511349464, 'mean_word_length': 2.205435651478817, 'pattern_counts': {'":': 0, '<': 7, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '5625173', 'n_tokens_mistral': 1069, 'n_tokens_neox': 1005, 'n_words': 204}