cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 
Check out the JMP® Marketplace featured Capability Explorer add-in
Choose Language Hide Translation Bar
LNitz
Level IV

Translating JSON files in large quantities: looping the JSON Parser add-on

Xan Gregg's JMP Add-in for reading JSON files is the best application I have found for seamlessly reading JSON produced by the Twitter APIv2.  With one complication:  I have 238 files, all about 300KB, pulled from the API over the course of a day on a schedule with enough time delay so as not to cause an API error.     Reading 238 files with the menu selection is a difficult and likely error-prone task.  Even labeling the results correctly will be a problem.

 

Can anyone see how much of the front-end and back-end setup for the JMP menu I can carve off in order to run the body of the parser in a loop that will pick up the files (e.g. Twitt114.JSON) translate, and rewrite with the same name (Twitt114.jmp) ?  

 

I am pretty sure that I won't be the only person who has acquired many small files as a consequence of avoiding being ejected by a Twitter or other API.

Cordially,

Larry Nitz

 

Source: JSON Importer Add-in for JMP 12 

1 ACCEPTED SOLUTION

Accepted Solutions
Craige_Hales
Super User

Re: Translating JSON files in large quantities: looping the JSON Parser add-on

Hard to say without seeing a file. Some JSON files are not structured to easily import into a rectangular table.

JMP has two tools that might help: the JSON wizard, and the multiple file import. If you can make the JSON wizard import the file correctly, you can use that source script in the MFI JSON tab.

What version of JMP are you using?

If you have an addin that does what you need, you can use the JSL via view->addins, select the addin, open the addin directory, open the jsl files you find.

use the JSON settings from the script the wizard makes in MFIuse the JSON settings from the script the wizard makes in MFI

Craige

View solution in original post

2 REPLIES 2
LNitz
Level IV

Re: Translating JSON files in large quantities: looping the JSON Parser add-on

This is an enticing, but not really correct solution:

open("C:\Users\lnitz\Documents\APIv2Trials\twtfile_b7.json","json")

 

The twtfile_b7.json is a Twitter API feed. The routine translates it correctly--but for one thing: At about midway in the list of variables, the routine writes lines for the left portion of the variables, then after that, writes lines containing only the right half of the variables.  But for that, it is an easy and perfect routine.  Perhaps there is a line-length setting that might be adjusted. So for 350 entries, I have about 350 with the left half, then 350 with the right half of the variables, more or less 700 lines out of the original 350.

Craige_Hales
Super User

Re: Translating JSON files in large quantities: looping the JSON Parser add-on

Hard to say without seeing a file. Some JSON files are not structured to easily import into a rectangular table.

JMP has two tools that might help: the JSON wizard, and the multiple file import. If you can make the JSON wizard import the file correctly, you can use that source script in the MFI JSON tab.

What version of JMP are you using?

If you have an addin that does what you need, you can use the JSL via view->addins, select the addin, open the addin directory, open the jsl files you find.

use the JSON settings from the script the wizard makes in MFIuse the JSON settings from the script the wizard makes in MFI

Craige