Skip to main content
AP_AW
Inspiring
October 9, 2016
Answered

JSON to SCORM 1.2 LMS

  • October 9, 2016
  • 1 reply
  • 2440 views

I trying to use javascript to store some JSON to a SCORM 1.2 LMS but it's failing.

I make a call like

SCORM_CallLMSSetValue("cmi.comments", JSON.stringify(data) );

// where 'data' is a one dim array

and it throws an exception because the value is an invalid string eg.

"["Test data"]"

Is this an issue with Cp or with the LMS?

This topic has been closed for replies.
Correct answer TLCMediaDesign

They do get appended as I explained in a previous post to you about storing a variable in the LMS. You need to use a delimiter to get the last comment. I use an asterisk and split the comment and grab the last index.

It' should b easy enough to create a comma separated string to put in the comments.

1 reply

TLCMediaDesign
Inspiring
October 10, 2016

Did you check the value of JSON.stringify(data) first?

AP_AW
AP_AWAuthor
Inspiring
October 10, 2016

Thanks for the reply.

I'm not 100% sure but the problem appears to be how this LMS handles strings. It appears to not be expecting the string to contain quotation marks and so is having problems.

At any rate when I checked the spec on how cmi.comments work, new comments get appended to existing ones which is fine but not something I want :-(

TLCMediaDesign
TLCMediaDesignCorrect answer
Inspiring
October 11, 2016

They do get appended as I explained in a previous post to you about storing a variable in the LMS. You need to use a delimiter to get the last comment. I use an asterisk and split the comment and grab the last index.

It' should b easy enough to create a comma separated string to put in the comments.