OpenersPrimaryExamplesSection(Spacer1)Examples  (3)

OpenersExampleSection0(Spacer1)Basic Examples  (3)

Import a JavaScript list:

ImportString["[1,2,3]", "JavaScriptExpression"]

Give a string consisting of a JavaScript object:

"{\"x\":1, \"y\":2, \"z\":3}"

Importing this string gives an association:

ImportString[%, "JavaScriptExpression"]

Import a JavaScript expression from (RefLink[ExternalEvaluate, paclet:ref/ExternalEvaluate]) using Node.js:

ImportString[ExternalEvaluate["NodeJS"->"String","2+2"],"JavaScriptExpression"]

Confirm that it is the same as using the "ReturnType" of (StringTypeLink["Expression", paclet:ref/interpreter/Expression]):

%==ExternalEvaluate["NodeJS"->"Expression","2+2"]

Evaluate a JavaScript object with (RefLink[ExternalEvaluate, paclet:ref/ExternalEvaluate]) and import it as an association:

ImportString[ExternalEvaluate["NodeJS"->"String","var x = {'a':1,'b':2}; x"],"JavaScriptExpression"]

({{DocumentationFooterIconsRelatedGuide.png, ({{Related Guides}, {▪(RefLinkPlain[Importing & Exporting, paclet:guide/ImportingAndExporting])}})}})