How can I import/reference the json library when using Skulpt?

25 views
Skip to first unread message

J Chapman

unread,
Jan 15, 2020, 10:45:56 AM1/15/20
to Skulpt
I have successfully downloaded Skulpt, and have it working on a webpage.

However, it seems to break (without giving an error message) when I try to import the json library. The following code outputs "Success" when run in browser using Skulpt:

#import json
print("Success")
(i.e. with the import json line commented out). However, this code does not print anything:

import json
print("Success")
Would anyone be able to help me understand why I am having this issue?

Brad Miller

unread,
Jan 15, 2020, 12:51:39 PM1/15/20
to Skulpt
Skulpt leaves it up to you to catch and communicate errors, which may be different for different people depending on how they have integrated skulpt into their site.

The reason JSON is not working is that it has not been ported to skulpt.  Modules are typically ported as people need them.

Brad

Austin Bart

unread,
Jan 16, 2020, 11:14:54 AM1/16/20
to Skulpt
I forget where we got it from, but the Blockpy fork for Skulpt has an implementation of the JSON package: https://github.com/blockpy-edu/skulpt/blob/master/src/lib/json/__init__.js
Reply all
Reply to author
Forward
0 new messages