Issue writing text responses to data #2011
-
Hello! I am conducting an experiment where participants will write an opinion about a current issue and then write in words they see during an RSVP task. Everything is working great except the write in data show up as [object Object]. I'm not really sure what I'm missing here to get the actual keyed responses recorded. Here is the code for the write-in:
Here is the code for the RSVP:
Any ideas would be greatly appreciated! |
Beta Was this translation helpful? Give feedback.
Replies: 3 comments 6 replies
-
Hi @jwylie21, this code is a little hard to follow - it's hard to understand what's going on without more information. For instance, the |
Beta Was this translation helpful? Give feedback.
-
Hi @becky-gilbert! It is the last part! When I look at the data file the type participant responses, they show up like "[object Object]". Attaching a datafile example here: moral_blinding_PARTICIPANT_SESSION_2021-07-12_15h27.59.836.csv |
Beta Was this translation helpful? Give feedback.
-
Hi @jwylie21, I think the problem is that you're using v6.1.0 for the core jspsych.js file: <script type="text/javascript" src="lib/vendors/jspsych-6.1.0/jspsych.js"></script> But it looks like the plugin files that you're using come from the jsPsych v6.3.0 release. There were a number of changes between these releases - see here for release notes. One of the changes was that the jsPsych data switched from internally storing complex data (objects and array) as JSON strings to storing these as native JavaScript objects/arrays, and then converting these JavaScript variables to strings in the last step of data saving (i.e. jsPsych.data.get().csv()). What this means in your case is that the plugins are saving the data as JavaScript objects/arrays, but because your jsPsych core file is older, it isn't converting these into strings. I think you have two options for dealing with this. One option is to switch to using the jspsych.js file from v6.3.0, so that it's consistent with the plugin versions that you're using. This is the best option IMO, but you should be aware that switching your jspsych.js file might cause other compatibility problems that you'll then have to fix. For instance, some of the plugin parameter and data names have changed, preloading moved from If you don't want to have to fix these other compatibility issues, then another option is to convert any complex data from JavaScript to JSON/CSV strings in the trial's var manip2 = {
type: 'survey-text',
questions: [
{prompt: "In early 2020 the COVID-19 pandemic swept across the world, resulting in significant loss of life. To make matters worse, many Americans have lost their jobs and livelihoods as a result of the pandemic. To slow the spread of the virus, the CDC has recommended that people get the COVID-19 vaccine. Some locations have made getting the vaccine mandatory. Despite the risk of spreading the virus, many people still choose not to get the COVID-19 vaccine. <p>In your own words, do you think it would be appropriate for the United States to make receiving the COVID-19 vaccine mandatory? Why or why not?</p>", rows: 6, columns: 40}
],
on_finish: function(data) {
data.response_json = JSON.stringify(data.response);
}
}; I think once you do that, the data should then be converted to CSV when the data is sent back to Pavlovia. But if not, you might end up with a JSON-formatted string inside the |
Beta Was this translation helpful? Give feedback.
Hi @jwylie21, I think the problem is that you're using v6.1.0 for the core jspsych.js file:
But it looks like the plugin files that you're using come from the jsPsych v6.3.0 release. There were a number of changes between these releases - see here for release notes. One of the changes was that the jsPsych data switched from internally storing complex data (objects and array) as JSON strings to storing these as native JavaScript objects/arrays, and then converting these JavaScript variables to strings in the last step of data saving (i.e. jsPsych.data.get().csv()). What this means in your case is that the p…