Parse JSON () es difícil de usar porque no maneja bien los errores. En una devolución de llamada, tal vez desde RunProgram o un botón, se creará un cuadro de diálogo de modelo no deseado que anunciará la falla. También anunciará el error en el registro. Se necesita JSL adicional para arreglarlo:
New Window( "parsejson",
Button Box( "parse",
local( {birestore, errText},
birestore = Batch Interactive( 1 ); // makes an alert dialog from a button without this
errText = Log Capture( p = Parse JSON( "\!n" /* invalid json error */ ) ); // writes to the log without this
Batch Interactive( birestore ); // pop the previous behavior
If( Length( errText ), Throw( "Caught an error:" || char(errText) ) ); // handle unexpected error, somehow
/* use p here */
)
)
);
Sugerencia: agregue un parámetro opcional para cambiar el comportamiento, algo como parseJson(x, throwIfError() )
Análisis JSON a prueba de fallos