jsonImportOptions
Create options for importing JSON data.
📝Syntax
opts = jsonImportOptions()
opts = jsonImportOptions('NumVariables', numVars)
opts = jsonImportOptions(..., Name, Value)
📥Input Arguments
Parameter Description
numVars number of variables (default: 1).
Name, Value property names and values of the object, and 'ParsingMode' ('lenient' or 'strict') which sets AllowComments, AllowInfAndNaN and AllowTrailingCommas.
📤Output Arguments
Parameter Description
opts nelson.io.json.JSONImportOptions object.
📄Description

jsonImportOptions creates an import options object for JSON files, to use with readtable and readtimetable. detectImportOptions returns the same object, filled from a JSON file.

Properties:

The object uses the Nelson class nelson.io.json.JSONImportOptions.

💡Examples
Select a nested value of each row:
f = [tempdir, 'students.json']; fid = fopen(f, 'w'); fprintf(fid, '%s', '[{"Name": {"FirstName": "Priya"}}, {"Name": {"FirstName": "Conor"}}]'); fclose(fid); opts = jsonImportOptions('VariableSelectors', "/Name/FirstName", 'TableSelector', "") T = readtable(f, opts)
🔗See Also
detectImportOptionsreadtablereadtimetablejsondecode
🕔Version History
Version Description
2.0.0 initial version
Edit this page on GitHub