BookmarkSubscribeRSS Feed


With the latest JMP 14 JSON Features: Parse JSON(); JSON To Data Table(); and JSON To List(); it would be really great if we could reverse this process.  I would like to turn a JSL Associative Array into a JSON string.  I realize there's a work around to turn a Data Table into a JSON string, but the most important of these features would be turning an AA into a JSON string.

Tracking Number:

Defect ID: S1495404

Community Member
Strong agree! I just sent much the same request to tech support: Hi. I’d like to request a feature analogous to the existing JSL function: dt= JSON To Data Table(); While it’s not complicated to script it manually, it would be nicer (and tidier) if we could also have one of these to do the reverse: dt << get JSON(); json = JSON From Data Table( dt ); I think the first form would be the most natural for experienced JSL users, but the second form surfaces it in the JSL lexicon a little better. Either way would work, of course. Similarly, while not too tough to do this manually, it would be nice to have an inverse for this: array|list = Parse JSON( json ); such as: json = As JSON ( list|array ); Thanks for considering these!
Super User

As I mention, for data tables there is an easy work around, which I'm not sure you are aware of.  It's still convoluted and should be a simple one liner.  For list and array's there is no work around however.  You'll have to script some solution.  I do hope JMP includes this directly in JMP.


Names Default To Here( 1 );
tempdir = "C:\TEMP\bigclass.json";
dt = Open( "$SAMPLE_DATA/Big" );
dt << Save( tempdir );
json = load text file( tempdir );
Delete File( tempdir );
dt2 = JSON To Data Table( json );
Community Member
Thanks, msharp, but what you're describing is what's already there: from JSON into data table. What we both requested is the reverse: from data table into JSON. Happily, it does exist already, though, and I've just bumped into where they've hidden it. In the GUI, it is in File/Export/JSON data, and the JSL equivalent is dt << save as(“filename.json”).
Super User


@erin_vang @msharp ,

As I think you both have figured out, dt << save [as] ("something.json") will create a json string output you want. I have passed the request along to our developers for a JSL message to retrieve the JSON string directly form the table without the need to save and reload from a file. 

However, the part that already does exist in JMP is the conversion from a JSL list/associative array to JSON. This can be done using the As JSON Expr() function.

aa = ["age" => 17, "height" => 68, "name" => "KIRK", "sex" => "M", "weight" => 134];

json = As JSON Expr( aa );

Write( "\!N" || json );